If a queue is empty and you don't want to block for too long, you risk getting a System.Messaging.MessageQueueException.
How would you tell the difference between a timeout on waiting for a message and a real error?
If a queue is empty and you don't want to block for too long, you risk getting a System.Messaging.MessageQueueException.
How would you tell the difference between a timeout on waiting for a message and a real error?
Try this:
MessageQueueException.MessageQueueErrorCode == MessageQueueErrorCode.IOTimeout
See http://msdn.microsoft.com/en-us/library/t5te2tk0.aspx for a sample similar to what you're trying to do.