Peeking or Retrieving Messages

MSMQ provides two methods for reading messages in a queue. The application can peek at the messages in the queue or retrieve the messages in the queue.

Peeking allows you to check a message without removing it from the queue. For example, if you are searching for a specific message in a queue, you may want to peek at each message's label or identifier to locate the message, and then retrieve the complete message once it is found.

Retrieving a message in a queue removes it from the queue. For example, if you want to purge a queue, you could retrieve each message in the queue.