我使用一个 azure 函数,每次将新消息发布到主题+订阅(不是队列!)时都会调用该函数
我到底需要在 azure 函数体内做什么才能将其显式移动到死信子队列?
根据 azure ,
Exceeding MaxDeliveryCount Queues and subscriptions each have a QueueDescription.MaxDeliveryCount and SubscriptionDescription.MaxDeliveryCount property respectively; the default value is 10. Whenever a message has been delivered under a lock (ReceiveMode.PeekLock), but has been either explicitly abandoned or the lock has expired, the message BrokeredMessage.DeliveryCount is incremented. When DeliveryCount exceeds MaxDeliveryCount, the message is moved to the DLQ, specifying the MaxDeliveryCountExceeded reason code.
从c#代码的角度来看,它们到底是什么意思
"explicitly abandoned or the lock has expired"
我在这里只讨论主题/订阅。请不要对服务总线队列发表评论,仅评论主题/订阅。 (即使逻辑是相同的,我只对这里处理主题/订阅感兴趣。谈论服务总线队列只会混淆问题的焦点)
最佳答案
您不能显式地对来自 Azure Function 的消息设置死信。在完成所有重试后,该函数将发出死信消息。 使用 C# 客户端并实现自定义接收逻辑时,可能会出现显式死信。
顺便说一句,订阅或队列,都没关系。它们都是队列。
关于azure - 如何在 Azure 函数中显式放弃由主题消息/订阅触发的消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54156166/