简体   繁体   English

Azure Service Bus中死信队列中的邮件是否过期?

[英]Do messages in dead letter queues in Azure Service Bus expire?

Do messages in dead letter queues in Azure Service Bus expire? Azure Service Bus中死信队列中的邮件是否过期?

Some explanation 一些解释

I have these queue settings: 我有这些队列设置:

var queueDescription = new QueueDescription("MyTestQueue")
{
    RequiresSession = false,
    DefaultMessageTimeToLive = TimeSpan.FromMinutes(1),
    EnableDeadLetteringOnMessageExpiration = true,
    MaxDeliveryCount = 10
};

namespaceManager.CreateQueue(queueDescription);

When I place some messages in a Azure Service Bus message queue (not queues from Azure Storage) and don't consume them (ever), they'll be moved to the dead letter queue automatically. 当我将一些消息放入Azure Service Bus消息队列(而不是来自Azure存储的队列)并且不消耗它们时(永远),它们将自动移动到死信队列。

However, if I have no consumer for the dead letter queue either, will the messages ever be deleted from the dead letter queue or will they stay there forever? 但是,如果我也没有死信队列的消费者,这些消息是否会从死信队列中删除,还是会永远留在那里? (Is there some official documentation stating how this is supposed to work?) (是否有一些官方文件说明这应该如何工作?)

My Trials 我的试炼

In my trials, I placed 3 messages in the queue. 在我的试验中,我在队列中放置了3条消息 They were dead lettered after 2 minutes or so. 他们在2分钟左右就死了。 They remained in the dead letter queue for at least a day and weren't removed. 他们至少在一天内留在死信队列中,并没有被删除。

消息队列统计信息

Although calling NamespaceManager.GetQueueAsync() gave me the values above (notice how MessageCount is still 3 but DeadLetterMessageCount is strangely 0 ), I could still receive the messages from the dead letter queue. 虽然调用NamespaceManager.GetQueueAsync()给了我上面的值(注意MessageCount仍然是3DeadLetterMessageCount奇怪地为0 ),我仍然可以从死信队列中接收消息。 (So they weren't removed from the queue.) (所以他们没有从队列中删除。)

Sebastian your observation is correct, in that messages once placed in the DeadLetter sub-queue never expire. Sebastian你的观察是正确的,因为一旦置于DeadLetter子队列中的消息永不过期。 They will be available there forever until removed explicitly from the DeadLetter sub-queue. 它们将永远在那里可用,直到从DeadLetter子队列中显式删除。 In the above error regarding the tooling/api it could be a refresh issue? 在上面关于工具/ api的错误中,它可能是一个刷新问题? The call to GetQueueAsync() needs to be made after the messages have been dead-lettered which is not a deterministic time, say if you had a queue with a thousand messages that were expired but that Queue was not being used (send/receive operations) then the count may still return as Active until some operations are performed. GetQueueAsync()的调用需要在消息被称为死信之后进行,这不是一个确定的时间,例如,如果你有一个队列,其中有一千条消息已经过期但是Queue没有被使用(发送/接收操作) )然后计数可能仍然作为活动返回,直到执行某些操作。

After doing some research I stumbled over a fact I missed completely: 在做了一些研究后,我偶然发现了一个我完全错过的事实:

Messages can expire even when dead lettering is disabled. 即使禁用了死信,消息也会过期。

When messages expire while dead lettering is disabled (which is the default), they'll just get deleted. 当消息过期而禁用死信(这是默认设置)时,它们将被删除。

So, Microsoft's reasoning for not auto-deleting messages from the dead letter queue is probably: 因此,微软推断不能从死信队列中自动删除邮件的原因可能是:

If you're enabling dead lettering, you explicitly want expired message not to be thrown away but stored somewhere else (the dead letter queue) so that you can review them. 如果您正在启用死信,那么您明确地希望过期的消息不会被丢弃,而是存储在其他地方(死信队列),以便您可以查看它们。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 过期时间过后,Azure Service Bus队列中的消息仍保留在队列中 - Messages in Azure Service Bus Queues remain in queue after expire time 使用存储队列和服务总线时,Azure 死信队列和毒药队列有什么区别? - What is the difference between Azure Dead Letter Queues and Poison Queues when using Storage Queue and Service Bus? Azure 服务总线 | 重新处理死信消息返回队列 | 如何接收来自死信队列的所有消息? - Azure service bus | Re process dead letter messages back to queue | How to receive all messages from dead letter queue? 通过MessageId在Azure Service Bus死信队列上获取消息 - Getting a Message by MessageId on the Azure Service Bus Dead Letter queue 如何删除Azure Service Bus队列中的死信? - How do you delete the dead letters in an Azure Service Bus queue? 我们可以使用 .net 代码从 Azure 服务总线中的死信队列中删除基于序列号的特定死信消息吗? - can we delete a specific dead letter message based on the sequence number from dead letter queue in Azure service bus using .net code? brokeredmessage微软服务总线队列ReceiveBatch无法获取所有死信消息 - brokeredmessage microsoft service bus queue ReceiveBatch not obtaining all dead letter messages 如何在 Azure 服务总线中显式向主题订阅死信队列发送消息 - How to send message to Topic Subscription Dead Letter Queue Explicitly in Azure Service Bus 从具有工作角色的多个动态队列中接收Azure服务总线消息 - Receiving Azure service bus messages from multiple, dynamically queues with worker role MassTransit在天蓝色服务总线上创建队列 - MassTransit creates queues on azure service bus
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM