[英]Session based service bus with Azure Function
I am using session queue on Azure and when I push some data on queue,I write one Azure function to trigger.我在 Azure 上使用会话队列,当我在队列上推送一些数据时,我编写了一个 Azure 函数来触发。
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.
函数“xxx”的侦听器无法启动。 Microsoft.ServiceBus: It is not possible for an entity that requires sessions to create a non-sessionful message receiver
Microsoft.ServiceBus:需要会话的实体无法创建非会话消息接收器
So my question is am I not able to use function with queue/topic with session?所以我的问题是我不能将函数与队列/主题与会话一起使用吗?
Update 2020: 2020 年更新:
Set isSessionsEnabled
property in your function.json
.在您的
function.json
设置isSessionsEnabled
属性。
This is a common ask, but currently Web Jobs SDK, and thus Azure Functions, don't support Service Bus sessions.
这是一个常见问题,但当前 Web 作业 SDK 以及 Azure Functions 不支持服务总线会话。
See
WebJobs SDK issue ;
请参阅
WebJobs SDK 问题;
unfortunately there's no progress 3 years after it was created.
不幸的是,它创建 3 年后没有任何进展。
Add a +1 in
Azure Functions issue .
在
Azure Functions 问题中添加 +1。
您需要在消费者 AF 的 function.json 中指定一个属性 "IsSessionsEnabled": true
I think its actually possible now, using the beta package Microsoft.Azure.WebJobs.Extensions.ServiceBus/3.1.0-beta2
.我认为它现在实际上是可能的,使用测试包
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:您也可以在 host.json 中指定新的 SessionHandlerOptions 部分:
{
"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 https://github.com/azure/azure-webjobs-sdk/issues/529#issuecomment-491113458
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.