How to set up Monitoring for queue in activemq

Vignesh picture Vignesh · Nov 11, 2011 · Viewed 16.3k times · Source

I read in ActiveMQ page, using JMX we can monitor queues in activemq. How can we get notified if a queue has messages (depth high) or service interval is high in ActiveMQ. Without using any shell scripts in unix environment. Is it possible through Java program? If yes, give me some ideas to get this done.

Answer

Faheem Sohail picture Faheem Sohail · Feb 21, 2013

For a JMX-free approach, you can also use the XML feed served by the activemq console page. The XML feed is hosted at http://ip:port/admin/xml/queues.jsp

This will have tags similar to this for each queue:

<queue name="your queue">
<stats size="0" consumerCount="1" enqueueCount="0" dequeueCount="0"/>
....
</queue>

Just parse this XML in your code and you are good to go.