azure - 为什么我的消息总是传送到 Azure 服务总线中的死信队列?

标签 azure azureservicebus azure-servicebus-queues

C# .NetCore 2.2 - Azure服务总线3.4.0

我在 Azure 服务总线中有 3 个具有相同属性的队列。当向这些队列发送消息时,其中一个队列中的消息总是被传递到死信队列,而其他 2 个队列则接收事件消息。

我尝试过使用这些属性 - 增加 TTL、最大传递计数等。所有 3 个队列的属性都是相同的,唯一的区别是队列的名称。

我已经使用了这个教程 - https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-get-started-with-queues

queue properties image

静态异步任务SendMessagesAsync(int numberOfMessagesToSend) {

try

{


    for (var i = 0; i < numberOfMessagesToSend; i++)

    {

        // Create a new message to send to the queue.

        string messageBody = $"Message {i}";

        var message = new Message(Encoding.UTF8.GetBytes(messageBody));

        Console.WriteLine($"Sending message: {messageBody}");

        // Send the message to the queue.
        await queueClient.SendAsync(message);
    }
}
catch (Exception exception)
{
    Console.WriteLine($"{DateTime.Now} :: Exception: {exception.Message}");
}

}

如何防止消息进入死信队列?为什么只有 1 个队列会发生这种情况,而其他 2 个队列却不会发生这种情况?

最佳答案

当消息是死信时,添加用户属性是有原因的。检查该属性以了解原因并进行相应的故障排除。具体来说,检查 DeadLetterReasonDeadLetterErrorDescription 自定义属性。

关于azure - 为什么我的消息总是传送到 Azure 服务总线中的死信队列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58440734/

相关文章:

Azure 服务总线高级版 - 异地恢复 - 丢弃的消息

c# - Azure C# 函数中的 Appsettings.json 等效项

azure - 如何使用 Azure Web App 容器公开端口 3000?

c# - 不同网络中两个应用程序之间的命令

azure - 如何处理 Azure Worker 角色中的非暂时性异常

Azure 服务总线主题和多实例订阅者

c# - 未收到 Azure 服务总线消息

Azure 辅助角色性能不一致 - 问题

asp.net-mvc-4 - 我应该在哪里注入(inject)用户在 MVC4 中进行身份验证之前需要运行的代码

azure - 如何使用 Spring Boot 建立 Microsoft azure databricks 增量表连接,就像 mysql、sql server 一样