Reputation: 185
I am using session queue on Azure and when I push some data on queue,I write one Azure function to trigger.
Please note that I have created statefull/session based queue.
The problem is when I push data to queue at that moment I got error like
The listener for function 'xxx' was unable to start. Microsoft.ServiceBus: It is not possible for an entity that requires sessions to create a non-sessionful message receiver
So my question is am I not able to use function with queue/topic with session?
Upvotes: 5
Views: 8303
Reputation: 35134
Update 2020:
Set isSessionsEnabled
property in your function.json
.
This is a common ask, but currently Web Jobs SDK, and thus Azure Functions, don't support Service Bus sessions. See WebJobs SDK issue; unfortunately there's no progress 3 years after it was created. Add a +1 in Azure Functions issue.
Upvotes: 9
Reputation: 73
You need to specify in function.json of consumer AF a property "IsSessionsEnabled": true
Upvotes: 3
Reputation: 72171
I think its actually possible now, using the beta package Microsoft.Azure.WebJobs.Extensions.ServiceBus/3.1.0-beta2
.
public static void Run([ServiceBusTrigger("core-test-queue1-sessions",
Connection = "AzureWebJobsServiceBus",
IsSessionsEnabled = true)]string myQueueItem,
IMessageSession messageSession,
ILogger log)
Also you can specify new SessionHandlerOptions section in host.json:
{
"version": "2.0",
"extensions": {
"serviceBus": {
"SessionHandlerOptions":
{
"MaxAutoRenewDuration": "00:01:00",
"MessageWaitTimeout": "00:05:00",
"MaxConcurrentSessions": 16,
"AutoComplete": true,
}
}
}
}
https://github.com/azure/azure-webjobs-sdk/issues/529#issuecomment-491113458
Upvotes: 5