Check the number of messages in the input queue

Is it possible to get the number of messages inside my InputQueue using NServiceBus and I need to get around it and use the native MSMQ interface?


This will not be full monitoring, we have a system consisting of several NSB components, and they are tracked using Windows performance counters. What I'm trying to achieve is just a simple operability check → sending an NSB message to a component, its response should contain the ability to tell the database access status and the number of MSMQ messages in its queue. That is why I would like to make it as simple as possible. So the question is: can I check the message number in a simple way, or will I need to read the performance counter?

+1
source share
1 answer

You will need to use System.Messaging.MessageQueue.GetAllMessages () or one of its enumerator methods to get this information. NServiceBus does not disclose this.

+1
source

Source: https://habr.com/ru/post/1437599/


All Articles