I am sending a message using the following code:
var transaction = new MessageQueueTransaction())
transaction.Begin( );
var message = new Message
{
Body = myContent,
Recoverable = true
};
m_oMessageQueue.Send( message , myTransaction );
transaction.Commit( );
And get it with an event handler BeginRecieveand ReceiveCompleted.
If my event handler does not work before the call EndRecieve, should the message remain in the queue and be available for subsequent calls to receive? The behavior that I see is that the message is gone forever. (Or maybe there is a timeout after which it will become available again?)
Update The code that receives the message is as follows.
var messageQueue = new MessageQueue( myPath );
messageQueue.ReceiveCompleted += messageQueue_ReceiveCompleted_ThrowException;
messageQueue.BeginReceive();
For test purposes, I throw an exception in the messageQueue_ReceiveCompleted_ThrowException event handler.
Then I repeat the above code with a working event handler, but I am not being called.