OpsCanary
azuremessagingPractitioner

Mastering Dead-Letter Queues in Azure Service Bus

5 min read Microsoft LearnApr 28, 2026
Share
PractitionerHands-on experience recommended

Dead-letter queues (DLQs) exist to handle messages that can't be delivered or processed. When a message exceeds the maximum delivery count or expires, it gets redirected to the DLQ instead of being lost. This mechanism ensures that you can investigate and resolve issues without losing critical data.

Messages are moved to the DLQ under specific conditions, such as exceeding the default maximum delivery count of 10. Additionally, if you enable the Time to Live (TTL) setting, any message that expires will also be sent to the DLQ. You can retrieve these messages using the dead-letter operation of the parent entity, but keep in mind that there’s no automatic cleanup; messages will remain in the DLQ until you explicitly handle them. This can lead to a buildup of messages if not monitored properly.

In production, be cautious with DLQs. If you have message types sent to a topic without subscribers, you may end up with a large number of DLQ messages, causing unnecessary load. Always ensure that your message architecture supports the expected delivery patterns to avoid overwhelming the DLQ. Remember, managing DLQs effectively can be the difference between a smooth operation and a chaotic message backlog.

Key takeaways

  • Understand that a dead-letter queue holds messages that can't be delivered or processed.
  • Monitor the maximum delivery count, which defaults to 10, to prevent messages from piling up in the DLQ.
  • Enable Time to Live (TTL) to automatically send expired messages to the DLQ.
  • Use the dead-letter operation to retrieve messages from the DLQ when necessary.
  • Avoid sending messages to topics without subscribers to prevent excessive DLQ load.

Why it matters

In production, managing dead-letter queues effectively prevents message loss and helps maintain system reliability. Proper handling ensures you can troubleshoot issues without impacting overall service performance.

Code examples

.NET
QueueClient.FormatDeadLetterPath(queuePath)
Azure CLI
az servicebus topic subscription show
.NET
ServiceBusReceiver.DeadLetterMessageAsync

When NOT to use this

Don't use this option in a production environment where you have message types that are sent to the topic, which don't have subscribers, as it may result in a large load of DLQ messages.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.