I want to monitor an embedded ActiveMQ 5.8 broker from inside the code.
- How can this be done?
- Do I need a JMX connection? I want to prevent exposing JMX
- Is there a way of accessing
org.apache.activemq.broker.jmx
Beans without JMX? - Are there Hooks, Listeners, Events, ... that can be attached to the broker itself?
- If this is a really bad idea, why?
You can access all the standard JMX MBeans from within the process that has an embedded broker without creating the JMX connector that would expose them to the outside world. First you need to tell the embedded broker to enable JMX but not create the connector.
Then in your code you can access the JMS MBeans as normal for instance to get the BrokerViewMBean:
Or to get a QueueViewMBean:
And similarly a TopicViewMBean.