azure - 如何在 Azure 函数中显式放弃由主题消息/订阅触发的消息?

标签 azure azure-functions azureservicebus azure-servicebus-topics

我使用一个 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/

相关文章:

python - 通过 Service Bus Explorer 接收的 Azure 事件数据采用十六进制格式

.net - 获取 AzureRmResource : A parameter cannot be found that matches parameter name 'Tag'

Azure 搜索 - 上传与合并或上传之间的区别

java - Azure Functions with java - 如何获取函数内写入的日志?

azure - 预编译的Function App中可以有多个函数吗?

azure - 寻求有关 Azure 服务总线中的事件中心与主题的清晰信息

php - 如何将我的 Azure 中的 Web 应用程序与 MySQL 数据库链接?

Azure 服务总线文件流

typescript - 为什么未收到我的 x-functions-key Azure Function header ?

c# - Azure Functions V2 的单元测试 MessageSender