Hi All,
I have a problem reading queue-messages async. My QueueReader has a Start()
and a Stop() method and if my app starts, it calls Start(). The problem is,
that there are possibly several hundreds of messages in the queue, which I
do not want to have processed by the async messagehandler at startup. So in
Start(), I create a new thread, which's method [called PreRead] just simply
enums the queue-messages [and processes them including remove]. At the end
of this thread, I fire an event. The eventhandler in turn executes a
"queue.BeginReceive()" and assigns the messagehandler to initiate async
processing. The messagehandler is then immidiately called, but hungs
forever. It hangs at
private void OnReceiveCompleted(Object source, ReceiveCompletedEventArgs
asyncResult)
{
MessageQueue q = (MessageQueue) source;
Message m = q.EndReceive(asyncResult.AsyncResult); //<< hungs.
The astoundig think is first, that the message-receiver is immidiately
called. My PreRead method uses a local queue object and all resources are
releases properly. I tried also to skip all that queue-processing in PreRead
and only fire the event finally. Event this leads to the same behavior.
So it looks like, if I start async reading from a different thread, it is
not working.
I use Windows 2000, en, SP4, all fixes, .Net 1.1, SP1
Any helpf would be great!
Best regards,
Manfred Braun
(Private)
Lange Roetterstrasse 7
D68167 Mannheim
Germany
mailto:manfred.braun-at-manfbraun.de
(Remove the anti-spam-"-at-" to mail me!)