0

I am trying to write a monitoring solution for ActiveMQ using C#. As part of that i need to monitor number of pending messages in a queue and number of consumers active for that queue. Can you please help me how to get number of consumers for a queue. I am able to count no of pending messages by using this answer

  • By the way - don't use a browser to count messages. It will be limited to a maxBrowsablePageSize, default 400 and will be a rather heavy operation to query frequently. Use the JMX/jolokia API instead for metrics. – Petter Nordlander Sep 17 '17 at 18:46

1 Answers1

0

For a management solution, I would use the JMX management API. Using a JVM language you could connect to ActiveMQ JMX that can tell you those metrics. For C# you want to use jolokia, which is a "JMX to HTTP brigde".

For instance: http://example.org:8161/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=MyQueueName

Would give you a JSON response with, among other metrics, ConsumerCount, EnqueueCount and DequeueCount.

Petter Nordlander
  • 22,053
  • 5
  • 50
  • 84