Dead-Letter Queues


Updated: July 19, 2016

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

Dead-letter queues are system-generated queues used for storing messages that could not be delivered. Message Queuing creates a transactional and a nontransactional dead-letter queue on each computer during setup. Storing undelivered messages on the source computer is called negative source journaling.

When a message is placed in a dead-letter queue, Message Queuing changes the class property of the message (PROPID_M_CLASS or MSMQMessage.MsgClass) to reflect the last known status of the message. For example, Message Queuing will change the class of the message and place it in the appropriate dead-letter queue if the message's time-to-reach-queue timer or time-to-be-received timer expires.

Only Message Queuing places messages in dead-letter queues. Applications can only read and delete messages in dead-letter queues.

When the journaling level (PROPID_M_JOURNAL or MSMQMessage.Journal) of a nontransactional message is set to MQMSG_DEADLETTER, any Message Queuing computer that cannot deliver the message before its time-to-reach-queue timer expires will place the undelivered message in the nontransactional dead-letter queue of that computer. This can be the source computer, the target computer, or any Message Queuing routing server in between. When an undelivered message is placed in a dead-letter queue, Message Queuing sets the class property of the message to indicate the reason why the message was not delivered.

System_CAPS_ICON_note.jpg Note

Only one copy of a message is stored on a computer at one time. When a message reaches a computer successfully, it is stored in an internal queue on that computer. If the message cannot be delivered to the next computer, it is then stored in the current computer's dead-letter queue.

When the journaling level (PROPID_M_JOURNAL or MSMQMessage.Journal) of a transactional message is set to MQMSG_DEADLETTER, the source queue manager places a copy of the message in the local transactional dead-letter queue if the source queue manager receives a negative acknowledgment message or does not receive a confirmation from the target queue manager indicating that the message was successfully retrieved from the destination queue (for example, if the message's time-to-be-received timer elapses before the source queue manager receives an acknowledgment message indicating that the message reached the destination queue or was retrieved from it). No notification is returned within the transaction confirmation process if the message is not delivered, is not received, or the receiving transaction is aborted. By default, the journaling property of transactional messages is not set to MQMSG_DEADLETTER.

Thus, the presence of a message in the transactional dead-letter queue confirms that it was not retrieved from the destination queue within a fixed time interval, and the message's class indicates the reason why the message was not retrieved.

The nontransactional and transactional dead-letter queues can be referenced by a machine format name or a direct format name. The following lines show the syntax of these format names:

DIRECT=AddressSpecification\SYSTEM$;DEADLETTER  (Introduced in MSMQ 2.0)   
DIRECT=AddressSpecification\SYSTEM$;DEADXACT    (Introduced in MSMQ 2.0)   

The following lines of code are examples of nontransactional and transactional dead-letter queue format name strings (note that the format name strings are null-terminated Unicode strings).

LPWSTR wsz = L"MACHINE=308FB580-1EB2-11CA-923B-08002B1075A7;DEADLETTER";  
LPWSTR wsz = L"MACHINE=308FB580-1EB2-11CA-923B-08002B1075A7;DEADXACT";  

MSMQ 1.0 did not allow sending applications to specify source journaling. For MSMQ 1.0, all transactional messages are placed in the transactional dead-letter queue after the time-to-be-received timer expires. All later versions of Message Queuing now allow complete control over source journaling.

For information onSee
When to use dead-letter queuesSource Journaling
Code examples for requesting negative source journalingTarget and Source Journaling Examples
Other system queuesSystem-Generated Queues
Positive and negative acknowledgment messagesAcknowledgment Message Classes
The elements and syntax of machine format namesMachine and Connector Format Names
The elements and syntax of direct format namesDirect Format Names

Community Additions