Warm tip: This article is reproduced from serverfault.com, please click

其他-azure servicebus maxConcurrentCalls 完全被忽略

(其他 - azure servicebus maxConcurrentCalls totally ignored)

发布于 2020-10-21 20:53:18

我的 host.json 中有这些,但是每次我运行该函数时,它都会并行运行比 1 多得多的线程(只要队列中有消息)

{
  "version": "2.0",
  "extensions": {
    "serviceBus": {
      "prefetchCount": 1,
      "messageHandlerOptions": {
        "maxConcurrentCalls": 1
      }
    }
  }
}

我的功能

 [FunctionName(nameof(ResourceEventProcessorFunction))]
    public async Task Run([ServiceBusTrigger("%TopicName%", "%SubscriptionName%", Connection = "ServiceBusConnection", IsSessionsEnabled = true)]Message message, IMessageSession messageSession, ILogger log)
Questioner
kosnkov
Viewed
0
kosnkov 2020-11-08 05:11:29

所以问题是每条消息都有一个不同的 sessionId。在 Azure 中的订阅上禁用 sessionId 解决了这个问题。

在下面的赏金细节中:D azure docs没有准确指定如何限制线程数,但我看起来有点笨拙。

一个 使用另一个MessageRecievePumpSessionRecievePumpMaxConcurrentCallsMaxConcurrentSessionsMaxConcurrentAcceptSessionCalls

如果你在订阅中包含会话(MaxConcurrentCalls 不起作用),请注意这一点,它仅在会话 ID 相同时才有效。当会话不同时尝试使用 MaxConcurrentSessions 或 MaxConcurrentAcceptSessionCalls 但请注意没有关于此的文档....