My Photo
Name:
Location: United States

Tuesday, May 09, 2006

MSMQ beginpeek endless loop

14.8 Calling BeginPeek from the delegate handler routine (after calling EndPeek to complete a previous BeginPeek call) results in an endless loop of peeking the same message. Why?
The current version of System.Messaging does not provide an asynchronous cursor that will let you peek the next message in a loop, asynchronously. A BeginPeek/EndPeek loop will peek the same message again and again. This is because BeginPeek always peeks the first message in a queue. If that message is not removed after a preceding EndPeek, the loop will keep peeking that same first message. You should consider using MessageQueueEnumerator.

0 Comments:

Post a Comment

<< Home