Discarding expired messages

Target Version: NServiceBus 6.x
Standard support for version 6.x of NServiceBus has expired. For more information see our Support Policy.


Messages with Time-To-Be-Received (TTBR) set are stored in the queue table just like regular messages. The only difference is that the Expires column is set to the time (in UTC) when the message expires. The calculation of expiry time is done on the database level so that clock drifts between endpoints don't affect the TTBR.


Messages with an elapsed Time-To-Be-Received (TTBR) are ignored by the message pump whose receive query has a where clause that excludes expired messages.

The expired messages are removed from the queue by a scheduled job which runs every 5 minutes. Each run the job attempts to remove all expired messages, in batches, using series of delete statements. Each batch is limited to 10000 messages.

Last modified