tags:

views:

19

answers:

0

I've been trying to figure out if there is a way to get the following from a MSMQ queue:

  • Current message count
  • Average message life (on the queue)
  • Timestamp from first and last message (So you can use average message life to calculate a rough estimate on wait times).

The MessageQueue class in System.Messaging doesn't seem to expose any of this, I can manually track message life, but it gets complicated in a decentralized system, and I'd assume MSMQ (being the central point) is tracking this somewhere.

Is there a managed API for this? If not, is there a unmanaged API I can p/Invoke?

If all else fails, is there any online samples for manually collecting these statistics?

EDIT: Found the answer to #1. You apparently need to use WMI or COM, these aren't exposed in System.Messaging:

http://yoelarnon.wordpress.com/2004/12/07/counting-the-number-of-messages-in-a-queue/

Still investigating on the rest.