Discarding expired messages

Component: MSMQ Transport
Standard support for version 6.x of NServiceBus has expired. For more information see our Support Policy.

The MSMQ transport can handle messages with a Time-To-Be-Received (TTBR) set in two ways.


When a message with a TTBR value is sent, NServiceBus translates the value to the native TTBR property of the MSMQ message. MSMQ continuously checks the Time-To-Be-Received of all queued messages. As soon as the message has expired, it is removed from the queue, and disk space gets reclaimed.

MSMQ enforces a single Time-To-Be-Received value for all messages in a transaction. If multiple messages enlist in a single transaction, then the TTBR from the first message will be used for all messages, leading to potentially unintentional message expiration. To prevent message loss, TTBR is not supported for endpoints with transaction mode SendsAtomicWithReceive or TransactionScope by default.


NServiceBus also annotates outgoing messages with an NServiceBus.TimeToBeReceived header.

This header is ignored by endpoints and messages with an elapsed NServiceBus.TimeToBeReceivedHeader value will be processed.

Related Articles

  • Discarding Old Messages
    Automatically discard messages if they have not been processed within a given period of time.

Last modified