Do messages in dead letter queues in Azure Service Bus expire?
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.
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. 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.
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.)