Session based service bus with Azure Function

萝らか妹 提交于 2019-12-06 00:05:46

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!