Open TDehaene opened 1 year ago
@gavin-aguiar pls comment and validate
I'm having the same errors with Python 3.10, v2 programming model. The examples here don't help either. Is this a bug? Or has anyone found a more complete example that works?
@TDehaene I've been experiementing Service Bus sessions recently. Not sure if the below code could help you.
import json
from typing import List
from azure.servicebus import ServiceBusMessage
from azure.servicebus.aio import ServiceBusClient
client = ServiceBusClient.from_connection_string("SB-CONN-STRING")
async def sample_session_send_receive_with_pool_async(
pay_load,
session_id,
):
async with client.get_topic_sender(topic_name='nextstep-service-bus') as sender:
await sender.send_messages(
ServiceBusMessage(
body=json.dumps(pay_load, default=str),
session_id=session_id,
subject='AI_SESSIONS_DEMO'
)
)
Please check this for more examples: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/samples/sync_samples
Investigative information
Please provide the following:
Repro steps
Provide the steps required to reproduce the problem:
I'm trying to create a Azure Service Bus Queue - triggered function using the Python v2 programming model, but I'm running into a bug.
I'm mainly following the steps outlined in this article: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-trigger?tabs=python-v2%2Cin-process%2Cextensionv5&pivots=programming-language-python
The only difference being that the Queue I have created is Session-aware.
I'm trying to figure out how to specify the Session-id, but can't seem to find it back in the documentation, nor anywhere online.![image](https://user-images.githubusercontent.com/22496343/230016364-96848187-6307-4409-8517-852feb5fb474.png)
Expected behavior
Screenshots Full screenshot from the logstream:![image](https://user-images.githubusercontent.com/22496343/230017194-6f302fcf-fa7c-45b8-ada6-e722165d8774.png)
Expected behavior
Provide a description of the expected behavior.
That I'm either able provide the Session-id as a decorator parameter, or that the functioning of the Queue-trigger for session-aware queues is agnostic, and can take in messages normally.
Actual behavior
Provide a description of the actual behavior observed.
The error message is as follows:
It works fine for a non-Session-aware Queue trigger, but it starts throwing the error if I make it Session-aware. I also can't seem to find any parameter for the decorator that would allow me to specify the Session-id.
Contents of the requirements.txt file:
Provide the requirements.txt file to help us find out module related issues.