I send 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 receive it using a BeginRecieve
and a ReceiveCompleted
event handler.
If my event handler fails before calling EndRecieve
, should the message remain on the queue and be available to a subsequent calls to receive? The behavior I am seeing is that the message is gone forever. (Or maybe there is a timeout after which point it will become available again?)
Update The code receiving the message looks like this.
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.
I then repeat the above code with a working event handler but i doesn't get called.