1
votes

Using the activemq jms for queue mechanism, I would like to monitor my queue for example the size of the queue. And i am using Jolokia as the bridge to perform rest requests on JMX.

Queue is configured in the wildfly and works fine:

<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
        <server name="default">
            <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
                ...
            </http-connector>
            <http-acceptor name="http-acceptor" http-listener="default"/>
                ...
            </http-acceptor>
            <jms-queue name="QueueName" entries="java:/jms/queue/QueueName"/>
            <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
        </server>
</subsystem>

I have deployed Jolokia war file on wildfly under deployments and the following url brings me a list of attributes:

   localhost:8080/jolokia/list 

Now i would like to read information about my queue, so i use the following rest request:

   localhost:8080/jolokia/read/org.apache.activemq.artemis:module=JMS,type=Queue,name=*QueueName*

However, this throws back the following exception:

  "stacktrace": "javax.management.InstanceNotFoundException: No MBean with pattern org.apache.activemq.artemis:module=JMS,type=Queue,name=*QueueName* found for reading attributes\n\tat org.jolokia.handler.ReadHandler.searchMBeans(ReadHandler.java:160)\n\tat org.jolokia.handler.ReadHandler.fetchAttributesForMBeanPattern(ReadHandler.java:126)\n\tat org.jolokia.handler.ReadHandler.doHandleRequest(ReadHandler.java:116)\n\tat org.jolokia.handler.ReadHandler.doHandleRequest(ReadHandler.java:37)\n\tat org.jolokia.handler.JsonRequestHandler.handleRequest(JsonRequestHandler.java:161)\n\tat org.jolokia.backend.MBeanServerHandler

I have tried to enable the jmx in standalone by adding the jmx subsystem as following:

<subsystem xmlns="urn:jboss:domain:jmx:1.3">
        <remoting-connector use-management-endpoint="false"/>
</subsystem>


 <connector socket-binding="jmx-remote" name="jmx-remote-connector" security-    realm="ApplicationRealm"/>


 <socket-binding name="jmx-remote" port="${jboss.jmx.port:7909}" fixed-port="false"/>

But it still does not work. Any help regarding the corrections for my approach or an alternative approach would be appreciated.

1

1 Answers

2
votes

If *QueueName* contains a / it needs to be escaped using !/. For example jms/inputq must be converted to jms!/inputq.

If you want to avoid the escaping you can use a query parameter q. The url then ends up looking like /jolokia?p=/read/....

For more information about escaping, see https://jolokia.org/reference/html/protocol.html