Clemens Vasters has a nice addition to his series on fault tolerant/reliable messaging. I especially liked the following lines of code that keep the begin/end peek in the same method:
IAsyncResult asynchResult = sourceQueue.BeginPeek(TimeSpan.FromSeconds( peekTimeout),null,null);
int firedWaitHandle = WaitHandle.WaitAny(new WaitHandle[]{asynchResult.AsyncWaitHandle, pauseInterrupt, stopInterrupt});
if ( firedWaitHandle == 0 )
{
sourceQueue.EndPeek(asynchResult);
Interesting. Remarkably like a straight-up peek, but allowing for the stop and pause interrupts. The rest of the related code puts it into context, but it looks like fun stuff.
Comments