You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by cooshal <ku...@gmail.com> on 2019/04/16 13:23:15 UTC

Is it possible to retrieve more than 400 messages from ActiveMQ queue via Jolokia API?

I have a custom error queue in ActiveMQ, which is populated by Apache Camel's
onException(..) error handler. There can 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.

I am using 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
[https://github.com/apache/activemq/blob/master/activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java#L58]).
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.



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html

Re: Is it possible to retrieve more than 400 messages from ActiveMQ queue via Jolokia API?

Posted by cooshal <ku...@gmail.com>.
Thank you @gtully for your reply.

Artemis seems to make life easier. Unfortunately, I cannot switch to Artemis
at the moment.

Thus, I switched my implementation to fetch these information using JMS API
and that works pretty well (tested via a normal Java application) , but then
again came up the issue of JMS 2.0 and ActiveMQ when I tested it in osgi.

 I guess I need to create a new thread on this issue.



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html

Re: Is it possible to retrieve more than 400 messages from ActiveMQ queue via Jolokia API?

Posted by Gary Tully <ga...@gmail.com>.
that maxBrowsePageSize limit is exposed as a destination policyEntry,
you can raise it very high and then a browse will be limited by the
memory usage limits.
the point of the limit is that the messages are dispatched from
memory, there is no browser implementations that will query the
message store and paginate the messages, it is simply a limited view
the head of the queue.
Artemis does a better job in allowing a browser to consume the entire queue.

On Tue, 16 Apr 2019 at 14:27, cooshal <ku...@gmail.com> wrote:
>
> I have a custom error queue in ActiveMQ, which is populated by Apache Camel's
> onException(..) error handler. There can 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.
>
> I am using 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
> [https://github.com/apache/activemq/blob/master/activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java#L58]).
> 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.
>
>
>
> --
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html