Skip to content

MSMQ list the name and count the Queues

Nepethya Rana

Asked May 4, 2016, 8:43 PM EDT1 answer
Share
LinkedInX
How do I get the name of the queues with only messages and how do I count the message on each queues which has message in console application?

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    You can read the Performance Counter value for the queue directly from .NET:

    SQL
    using System.Diagnostics;  // ... var queueCounter = new PerformanceCounter( "MSMQ Queue", "Messages in Queue", @"machinename\private$\testqueue2");  Console.WriteLine( "Queue contains {0} messages",      queueCounter.NextValue().ToString());
    Otherwise, you can see the queues in the server manager under Machine Name--> Features-->Private-->search your queue name.
    0