Tuesday, December 9, 2008

Monitor ActiveMQ started embedded

The activeMQ could be started embedded. But the normal monitor web console (http://localhost:8161/admin) does not work, the web console only works when the activeMQ is started standalone.
In this case, we can use JMX to monitor embedded ActiveMQ.
To make the activeMQ could be monitored by JMX. The configuration file must be set like this
<broker xmlns="http://activemq.apache.org/schema/core" useJmx="true" brokerName="epMQBroker">
......
<!-- This may collide with JBoss/Websphere/Weblogic so need to set the port manually for now-->
<managementContext>
<managementContext connectorPort="1099" jmxDomainName="localhost"/>
</managementContext>
......

After the activeMQ is started embedded, run jconsole in %JAVA_HOME%/bin, click the "Advanced" tab, input the JMX url
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi

Note the port number must be consistent with the port number in "managementContext" in the configuration file.

No comments:

Post a Comment