Search code examples
c#msmq

Handle MSMQ Send() message fails, not to lose message


I've just started to implement MSMQ, and I'm facing a situation that I don't know how to handle.

If I send a message to my MSMQ service, but because of whatever Send method throws an error, how can I handle it in order not to lose this message that was not sent to MSMQ? Are the any non-sent message qeue that I can proccess later on or I gotta handle it storing it in my database?

Many thanks.


Solution

  • If the Send() method raises an exception then have to assume the message hasn't been enqueued. You will need to handle that yourself and resend it.