Reputation: 1109
Disclaimer - I am new to the world of development on Azure.
I want to enable session based message handling in an Azure function which is based on ServiceBusTrigger. I am able to do that by setting the attribute IsSessionsEnabled = true
and having required session handler options in host.json.
Sample snippet:
//Azure function
public static void Run([ServiceBusTrigger("core-test-queue1-sessions", Connection = "AzureWebJobsServiceBus", IsSessionsEnabled = true)]string myQueueItem, ClientEntity clientEntity, ILogger log)
Session handler options in host.json
{
"version": "2.0",
"extensions": {
"serviceBus": {
"SessionHandlerOptions":
{
"MaxAutoRenewDuration": "00:01:00",
"MessageWaitTimeout": "00:05:00",
"MaxConcurrentSessions": 16,
"AutoComplete": true,
}
}
}
}
This is working fine in Azure Function v2. How to implement this in Azure Function v1 as the attribute IsSessionsEnabled and SessionHandlerOptions are not available in v1? Please suggest a workaround for this.
Upvotes: 1
Views: 510
Reputation: 6806
Use the Service Bus trigger to respond to messages from a Service Bus queue or topic. Starting with extension version 3.1.0, you can trigger on a session-enabled queue or topic.
But function v1 package is consists of service bus extension 2.x.x, so you can not enable session in Azure function v1.
You can refer to this document:
You can see the version of the package here:
Upvotes: 2