You can’t move a delivered MSMQ message

Quite often I see people discussing moving messages between queues and this mildly grates on my nerves.

Delivered messages can't be moved out of the queue they end up in - the only thing you can do is delete the message, either through receving it, purging the queue it is in, or waiting for any TimeToBeReceived timer to expire.

What is really meant by "moving" is to take the data from one message and use it to create a new message in a different queue. It is important to understand this for a couple of reasons:

  • MSMQ will regard the two messages as being different due their unique MessageID values.

  • Receiving a message from a queue will kick off any linked activities:

    • commiting the transaction used for ensuring removal of messages sent to transactional queues by creating acknowledgements to go back to the original sending machine (if requested when sent)

    • creating copies in the original destination's journal queue (if target journaling enabled on the queue)

If the applications used to send and receive messages don't implement any functionality that relies on MessageID and/or receipt acknowledgements then there won't be anything to worry about. For more sophisticated applications, moving messages between queues has the potential to break things.

Comments (0)

Skip to main content