MSMQ Dead Letter Queues

Component: MSMQ Transport
NuGet Package NServiceBus (4.x)
Standard support for version 4.x of NServiceBus has expired. For more information see our Support Policy.

Dead Letter Queues is a feature of MSMQ that tracks messages that are undeliverable, deleted, expired etc. NServiceBus endpoints will by default enable DLQ for all outgoing messages except messages that have a Time To Be Received(TTBR) set. This avoids expired messages ending up either in the TDLQ or DLQ (if non-transactional queues are used) wasting disk space on the machine when they time out.

DLQ can be disabled for the entire endpoint using the MSMQ connection string.

If DLQ is enabled messages will remain in the senders outgoing queue until processed and count towards disk space quota on the senders machine.

DLQ is be enabled by default for TTBR messages.

Monitoring DLQ

MSMQ moves messages that cannot be delivered to their destination to the DLQ. This may be due to misconfiguration of routing or queues being purged. See Dead-Letter Queues for a comprehensive list of conditions under which messages may be moved to the DLQ.

It is very important to monitor the DLQ in order to detect potential routing configuration errors or other situations that may lead to messages being moved to the dead-letter queue.

While there is usually a central error queue managed by NServiceBus, each machine has a separate dead-letter queue. This means that the DLQ on each machine has to be monitored individually.

Reading messages from DLQ

The following addresses can be used to read messages from DLQ on a given machine:


Performance counters

The MSMQ Queue performance object contains counters that can be used to monitor the number of messages in various queues. Value of the Messages in Queue counter of the Computer Queues instance tracks the number of messages in the DLQ on a given machine.

Last modified