1

I have an error queue in ActiveMQ, which is populated by Apache Camel's onException error handler. There could be thousands of messages in this queue.

Instead of using the ActiveMQ web console, I am building a custom web admin to integrate several other statistics from other components as well. Thus, I wanted to include the statistics from ActiveMQ as well.

ActiveMQ version: 5.14.3

I have looked at Jolokia JMX API, and its operations. For instance, I have the following payload to the broker's Jolokia API endpoint:

{
    "type": "exec",
    "mbean": "org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=test.errors",
    "operation": "browse(java.lang.String)",
    "arguments": ["EXCEPTION_TYPE LIKE '%jdbc%'"]
}

The header field EXCEPTION_TYPE is already populated via Apache Camel Route. I have more than 10k messages in this queue at the moment. I made a POST request to my broker API endpoint with the payload as shown above. Although I had more than 10k messages, this request resulted in just 400 messages (due to the max page size limitation, hard coded in the source code). This means that I will not be able to get more than 400 messages at a time via Jolokia. I also tried the browseMessages() method as well. Looks like, it does the same thing, in general.

  1. Is it possible to browse these messages (let's say if they are high in number, may be around 10k+)?
  2. Or, is it possible to paginate them? I could not see a relevant operation method for that.

I tried to see if Hawtio did something special in retrieving all the messages. But, the result is same( with max 400 messages).

ActiveMQ web console does fetch all the messages. This probably could be because it is tightly coupled with the ActiveMQ project.

I am not restricted to just JMX/Jolokia. If these stats can be fetched via some API, its equally fine.

Any inputs would be great !

cooshal
  • 758
  • 8
  • 21
  • 1
    Why can't you just browse the messages with the JMS API instead of Jolokia? The browsing available via Jolokia is just a convenience for really simple tasks. – Justin Bertram Apr 16 '19 at 13:36
  • I guess you are right. I encountered some limitations with Jolokia. Thank you for pointing this out. I will try this via JMS API instead. – cooshal Apr 16 '19 at 13:43
  • Were you able to solve this problem? – Rahul Jul 23 '20 at 11:20
  • 1
    Hi @Rahul, it seems that this problem came up due to my activemq configuration window size. I think I used something like `` in my activemq config. http://activemq.2283324.n4.nabble.com/JMS-QueueBrowser-does-not-return-actual-number-of-messages-in-the-queue-td4751166.html#a4751264 – cooshal Jul 23 '20 at 11:55

0 Answers0