为什么我的邮件总是传递到Azure Service Bus中的Dead Letter Queue?

问题描述 投票:0回答:2

C#.NetCore 2.2-Azure Service Bus 3.4.0]

我在Azure Service Bus中有3个具有相同属性的队列。在将消息发送到这些队列时,其中一个队列中的消息总是传递到死信队列,而其他两个队列接收活动消息。

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

我已使用本教程-https://docs.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}");
}

}

如何防止邮件进入“死信队列”?为什么只有一个队列而不是其他两个队列发生?

azure azureservicebus azure-servicebus-queues
2个回答
0
投票

没有看到您的应用/消息,很难提供帮助。但是,尝试使用该消息的应用程序可能存在错误。由于无法完成,因此消息进入了死信队列。

记录来自此特定队列的消息,并查看是否缺少任何必需的属性。有时您试图反序列化为不兼容的类型。

死信队列的目的是保存不能传递给任何接收者,或无法处理的消息。


0
投票

当邮件被硬写时,有一个添加用户属性的原因。检查该属性以查看原因并进行相应的故障排除。具体来说,检查DeadLetterReasonDeadLetterErrorDescription自定义属性。

© www.soinside.com 2019 - 2024. All rights reserved.