Asynchronous Reads from MSMQ

K

Konstantin

Hello,

I am implementing an asynchronous message processing using MSMQ. Since I
want to process more than one message at a time BeginReceive is getting
called within the event handler. The application seems to start hanging at
the method that does the processing. The snippet below shows in a nutshell
what I am trying to do. MessageParser object is created successfully but the
ProcessMessage method is never called. Any ideas about what I am doing
wrong are greatly appreciated.

private void OnReceiveCompleted(object sender, ReceiveCompletedEventArgs e)
{
Message msg = _queue.EndReceive(e.AsyncResult);
_queue.BeginReceive();
MessageParser mp = new MessageParser(msg);
mp.ProcessMessage(); ///Stalls here
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top