本文介绍了不要在死信队列中的消息在Azure的服务总线过期吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像标题所说:不要在Azure的服务总线死信队列中的消息过期(这只是出于好奇)

Just like the title says: Do messages in dead letter queues in Azure Service Bus expire? (This is just out of curiosity.)

我有这些队列设置:

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

namespaceManager.CreateQueue(queueDescription);

当我把在Azure的服务总线的消息队列的一些消息(从Azure存储不队列),并且不消耗他们(以往),他们会自动移动到死信队列。

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.

不过,如果我没有消费者对死信队列或者将消息不断从死信队列删除或他们将永远呆在那里? (有一些官方文档说明这是如何工作的?)

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?)

在我的考验,我放的 3消息的队列中。他们2分钟或这样后死亡字母。他们留在死信队列为至少一天并不会被删除。

In my trials, I placed 3 messages in the queue. They were dead lettered after 2 minutes or so. They remained in the dead letter queue for at least a day and weren't removed.

虽然叫NamespaceManager.GetQueueAsync()给了我上面(注意这些数值 MessageCount 还是 3 ,但 DeadLetterMessageCount 是奇怪的 0 ),我仍然可以接收来自死信队列中的消息。 (因此,它们不从队列中删除。)

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. (So they weren't removed from the queue.)

推荐答案

塞巴斯蒂安你的观察是正确的,在一次放置在死信子队列永不过期的消息。他们将可以永远存在,直到从死信子队列中显式删除。在关于工装上面的错误/ API,它可能是一个刷新的问题?到GetQueueAsync()的调用需要进行消息已经死字母的这不是一个确定的时间,说如果你有与被过期,但没有被使用的队列一千消息队列之后(发送/接收操作),那么,直到一些操作执行计数可能仍然返回为活动状态。

Sebastian your observation is correct, in that messages once placed in the DeadLetter sub-queue never expire. They will be available there forever until removed explicitly from the DeadLetter sub-queue. In the above error regarding the tooling/api it could be a refresh issue? 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.

这篇关于不要在死信队列中的消息在Azure的服务总线过期吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 05:32