Revision: 62597
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 1, 2013 13:00 by gaserland
Initial Code
protected Message PeekWithoutTimeout(MessageQueue q, Cursor cursor, PeekAction action) { Message ret = null; try { ret = q.Peek(new TimeSpan(1), cursor, action); } catch (MessageQueueException mqe) { if (!mqe.Message.ToLower().Contains("timeout")) { throw; } } return ret; } protected int GetMessageCount(MessageQueue q) { int count = 0; Cursor cursor = q.CreateCursor(); Message m = PeekWithoutTimeout(q, cursor, PeekAction.Current); if (m != null) { count = 1; while ((m = PeekWithoutTimeout(q, cursor, PeekAction.Next)) != null) { count++; } } return count; }
Initial URL
Initial Description
Counting Messages in an MSMQ MessageQueue from C#
Initial Title
Counting Messages in an MSMQ MessageQueue
Initial Tags
Initial Language
C#