You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Simon Lundström <si...@su.se> on 2022/02/09 10:10:32 UTC

ActiveMQ Classic topic JMX metrics

Hey all!

Via JMX you can fetch metrics about e.g. queues in ActiveMQ Classic. So
the queue somequeue have the EnqueueCount attribute at
org.apache.activemq:type=Broker,brokerName=activemq.su.se,destinationType=Queue,destinationName=somequeue
which contains the number of messages enqueued to the queue.

However for topics the EnqueueCount does not move and I can't find any
other attribute that moves either.

How can I see how many messages are or has been sent to a topic?

BR,
- Simon

Re: ActiveMQ Classic topic JMX metrics

Posted by Simon Lundström <si...@su.se>.
On Fri, 2022-02-11 at 17:01:54 +0100, Matt Pavlovich wrote:
> Server-side “Composite Topic” using a destination interceptor to route to other destinations?

Yes.

> Client-side “Composite Topic” where you specify multiple destinations session.createConsumer(session.createTopic(“TOPIC.A,TOPIC.B”)) ?
> 
> Either way, you should see consumer counts on the destination that a _consumer_ is connected.

We don't, ConsumerCount on the topic is 0.

BR,
- Simon

Re: ActiveMQ Classic topic JMX metrics

Posted by Matt Pavlovich <ma...@gmail.com>.
Server-side “Composite Topic” using a destination interceptor to route to other destinations?

..or..

Client-side “Composite Topic” where you specify multiple destinations session.createConsumer(session.createTopic(“TOPIC.A,TOPIC.B”)) ?

Either way, you should see consumer counts on the destination that a _consumer_ is connected.

Also.. check the usual JMS gotchas.. does the code call “connection.start()”? Is there a thread running to keep the consumer program looping vs exiting right away? 

Thanks,
Matt Pavlovich

> On Feb 11, 2022, at 3:38 AM, Simon Lundström <si...@su.se> wrote:
> 
> compositeTopics


Re: ActiveMQ Classic topic JMX metrics

Posted by Simon Lundström <si...@su.se>.
On Fri, 2022-02-11 at 13:54:25 +0100, Tim Bain wrote:
> Do the JMX counters for the queues that make up the composite topics
> increment as expected?

Yep!

> I've never used composite topics so I've got no direct experience, but I
> would expect the internal consumers to show up in JMX and the counters for
> both the topics and the consumers to increase, consistent with the behavior
> of non-composite topics.

I can't find the consumer producer in JMX but that's partly because we
have some consumers that disconnect and reconnect in a very tight loop
(don't ask...).

> Would you be willing to create a feature request in JIRA asking for
> that to be added?

https://issues.apache.org/jira/browse/AMQ-8485

Done, let me know if I can clarify the issue.

BR,
- Simon

> On Fri, Feb 11, 2022, 2:38 AM Simon Lundström <si...@su.se> wrote:
> 
> > On Thu, 2022-02-10 at 14:05:42 +0100, Tim Bain wrote:
> > > It's been a while since I've looked at the JMX beans, but I believe that
> > > each topic consumer has its own MBean somewhere in the tree, with
> > > individual per-consumer stats. Are those increasing even though the topic
> > > is not?
> >
> > I can't find any topic consumers. I just realized that all of our
> > topics are compositeTopics.
> >
> > > And for that matter, do you have at least one consumer connected and
> > > consuming messages from the topic? If there are no consumers, messages
> > > produced to the topic are immediately discarded and I don't know if
> > that's
> > > done as an enqueue-dequeue or as a no-op but I suspect the latter, which
> > > would explain what you're seeing.
> >
> > I'm guessing that the internal consumer/producer that the
> > compositeTopics don't behave like a normal consumer?
> >
> > > On Wed, Feb 9, 2022, 4:15 PM Matt Pavlovich <ma...@gmail.com> wrote:
> > >
> > > > How are you sending messages to the broker?
> >
> > JMS, STOMP and AMQP.
> >
> > BR,
> > - Simon
> >
> > > On Wed, Feb 9, 2022, 4:15 PM Matt Pavlovich <ma...@gmail.com> wrote:
> > >
> > > > How are you sending messages to the broker?
> > > >
> > > > > On Feb 9, 2022, at 11:12 AM, Simon Lundström <si...@su.se> wrote:
> > > > >
> > > > > If you are talking about /amq/admin/topics.jsp when you say console
> > it's
> > > > > all zeroes.
> > > > >
> > > > > org.apache.activemq:type=Broker,brokerName=activemq.it.su.se
> > > > ,destinationType=Topic,destinationName=exampletopic
> > > > > does not change even if I press Refresh in JVisualVM. Same in
> > JConsole
> > > > > (not that it makes any difference, it's all JMX).
> > > > >
> > > > > How are these metrics updated? Nothing related to advisory messages
> > > > > right?
> > > > >
> > > > > BR,
> > > > > - Simon
> > > > >
> > > > > On Wed, 2022-02-09 at 13:01:57 +0100, Matt Pavlovich wrote:
> > > > >> Hello Simon-
> > > > >>
> > > > >> Those JMX counter metrics most definitely change. If you are using
> > > > tool, such as console you may need to click ‘Refresh’ as data is going
> > > > through.
> > > > >>
> > > > >> -Matt Pavlovich
> > > > >>
> > > > >>> On Feb 9, 2022, at 4:10 AM, Simon Lundström <si...@su.se> wrote:
> > > > >>>
> > > > >>> Hey all!
> > > > >>>
> > > > >>> Via JMX you can fetch metrics about e.g. queues in ActiveMQ
> > Classic. So
> > > > >>> the queue somequeue have the EnqueueCount attribute at
> > > > >>> org.apache.activemq:type=Broker,brokerName=activemq.su.se
> > > > ,destinationType=Queue,destinationName=somequeue
> > > > >>> which contains the number of messages enqueued to the queue.
> > > > >>>
> > > > >>> However for topics the EnqueueCount does not move and I can't find
> > any
> > > > >>> other attribute that moves either.
> > > > >>>
> > > > >>> How can I see how many messages are or has been sent to a topic?
> > > > >>>
> > > > >>> BR,
> > > > >>> - Simon
> > > > >>
> > > >
> > > >
> >

Re: ActiveMQ Classic topic JMX metrics

Posted by Tim Bain <tb...@alumni.duke.edu>.
Do the JMX counters for the queues that make up the composite topics
increment as expected?

I've never used composite topics so I've got no direct experience, but I
would expect the internal consumers to show up in JMX and the counters for
both the topics and the consumers to increase, consistent with the behavior
of non-composite topics. Would you be willing to create a feature request
in JIRA asking for that to be added?

Tim

On Fri, Feb 11, 2022, 2:38 AM Simon Lundström <si...@su.se> wrote:

> On Thu, 2022-02-10 at 14:05:42 +0100, Tim Bain wrote:
> > It's been a while since I've looked at the JMX beans, but I believe that
> > each topic consumer has its own MBean somewhere in the tree, with
> > individual per-consumer stats. Are those increasing even though the topic
> > is not?
>
> I can't find any topic consumers. I just realized that all of our
> topics are compositeTopics.
>
> > And for that matter, do you have at least one consumer connected and
> > consuming messages from the topic? If there are no consumers, messages
> > produced to the topic are immediately discarded and I don't know if
> that's
> > done as an enqueue-dequeue or as a no-op but I suspect the latter, which
> > would explain what you're seeing.
>
> I'm guessing that the internal consumer/producer that the
> compositeTopics don't behave like a normal consumer?
>
> > On Wed, Feb 9, 2022, 4:15 PM Matt Pavlovich <ma...@gmail.com> wrote:
> >
> > > How are you sending messages to the broker?
>
> JMS, STOMP and AMQP.
>
> BR,
> - Simon
>
> > On Wed, Feb 9, 2022, 4:15 PM Matt Pavlovich <ma...@gmail.com> wrote:
> >
> > > How are you sending messages to the broker?
> > >
> > > > On Feb 9, 2022, at 11:12 AM, Simon Lundström <si...@su.se> wrote:
> > > >
> > > > If you are talking about /amq/admin/topics.jsp when you say console
> it's
> > > > all zeroes.
> > > >
> > > > org.apache.activemq:type=Broker,brokerName=activemq.it.su.se
> > > ,destinationType=Topic,destinationName=exampletopic
> > > > does not change even if I press Refresh in JVisualVM. Same in
> JConsole
> > > > (not that it makes any difference, it's all JMX).
> > > >
> > > > How are these metrics updated? Nothing related to advisory messages
> > > > right?
> > > >
> > > > BR,
> > > > - Simon
> > > >
> > > > On Wed, 2022-02-09 at 13:01:57 +0100, Matt Pavlovich wrote:
> > > >> Hello Simon-
> > > >>
> > > >> Those JMX counter metrics most definitely change. If you are using
> > > tool, such as console you may need to click ‘Refresh’ as data is going
> > > through.
> > > >>
> > > >> -Matt Pavlovich
> > > >>
> > > >>> On Feb 9, 2022, at 4:10 AM, Simon Lundström <si...@su.se> wrote:
> > > >>>
> > > >>> Hey all!
> > > >>>
> > > >>> Via JMX you can fetch metrics about e.g. queues in ActiveMQ
> Classic. So
> > > >>> the queue somequeue have the EnqueueCount attribute at
> > > >>> org.apache.activemq:type=Broker,brokerName=activemq.su.se
> > > ,destinationType=Queue,destinationName=somequeue
> > > >>> which contains the number of messages enqueued to the queue.
> > > >>>
> > > >>> However for topics the EnqueueCount does not move and I can't find
> any
> > > >>> other attribute that moves either.
> > > >>>
> > > >>> How can I see how many messages are or has been sent to a topic?
> > > >>>
> > > >>> BR,
> > > >>> - Simon
> > > >>
> > >
> > >
>

Re: ActiveMQ Classic topic JMX metrics

Posted by Simon Lundström <si...@su.se>.
On Thu, 2022-02-10 at 14:05:42 +0100, Tim Bain wrote:
> It's been a while since I've looked at the JMX beans, but I believe that
> each topic consumer has its own MBean somewhere in the tree, with
> individual per-consumer stats. Are those increasing even though the topic
> is not?

I can't find any topic consumers. I just realized that all of our
topics are compositeTopics.

> And for that matter, do you have at least one consumer connected and
> consuming messages from the topic? If there are no consumers, messages
> produced to the topic are immediately discarded and I don't know if that's
> done as an enqueue-dequeue or as a no-op but I suspect the latter, which
> would explain what you're seeing.

I'm guessing that the internal consumer/producer that the
compositeTopics don't behave like a normal consumer?

> On Wed, Feb 9, 2022, 4:15 PM Matt Pavlovich <ma...@gmail.com> wrote:
> 
> > How are you sending messages to the broker?

JMS, STOMP and AMQP.

BR,
- Simon

> On Wed, Feb 9, 2022, 4:15 PM Matt Pavlovich <ma...@gmail.com> wrote:
> 
> > How are you sending messages to the broker?
> >
> > > On Feb 9, 2022, at 11:12 AM, Simon Lundström <si...@su.se> wrote:
> > >
> > > If you are talking about /amq/admin/topics.jsp when you say console it's
> > > all zeroes.
> > >
> > > org.apache.activemq:type=Broker,brokerName=activemq.it.su.se
> > ,destinationType=Topic,destinationName=exampletopic
> > > does not change even if I press Refresh in JVisualVM. Same in JConsole
> > > (not that it makes any difference, it's all JMX).
> > >
> > > How are these metrics updated? Nothing related to advisory messages
> > > right?
> > >
> > > BR,
> > > - Simon
> > >
> > > On Wed, 2022-02-09 at 13:01:57 +0100, Matt Pavlovich wrote:
> > >> Hello Simon-
> > >>
> > >> Those JMX counter metrics most definitely change. If you are using
> > tool, such as console you may need to click ‘Refresh’ as data is going
> > through.
> > >>
> > >> -Matt Pavlovich
> > >>
> > >>> On Feb 9, 2022, at 4:10 AM, Simon Lundström <si...@su.se> wrote:
> > >>>
> > >>> Hey all!
> > >>>
> > >>> Via JMX you can fetch metrics about e.g. queues in ActiveMQ Classic. So
> > >>> the queue somequeue have the EnqueueCount attribute at
> > >>> org.apache.activemq:type=Broker,brokerName=activemq.su.se
> > ,destinationType=Queue,destinationName=somequeue
> > >>> which contains the number of messages enqueued to the queue.
> > >>>
> > >>> However for topics the EnqueueCount does not move and I can't find any
> > >>> other attribute that moves either.
> > >>>
> > >>> How can I see how many messages are or has been sent to a topic?
> > >>>
> > >>> BR,
> > >>> - Simon
> > >>
> >
> >

Re: ActiveMQ Classic topic JMX metrics

Posted by Tim Bain <tb...@alumni.duke.edu>.
It's been a while since I've looked at the JMX beans, but I believe that
each topic consumer has its own MBean somewhere in the tree, with
individual per-consumer stats. Are those increasing even though the topic
is not?

And for that matter, do you have at least one consumer connected and
consuming messages from the topic? If there are no consumers, messages
produced to the topic are immediately discarded and I don't know if that's
done as an enqueue-dequeue or as a no-op but I suspect the latter, which
would explain what you're seeing.

Tim

On Wed, Feb 9, 2022, 4:15 PM Matt Pavlovich <ma...@gmail.com> wrote:

> How are you sending messages to the broker?
>
> > On Feb 9, 2022, at 11:12 AM, Simon Lundström <si...@su.se> wrote:
> >
> > If you are talking about /amq/admin/topics.jsp when you say console it's
> > all zeroes.
> >
> > org.apache.activemq:type=Broker,brokerName=activemq.it.su.se
> ,destinationType=Topic,destinationName=exampletopic
> > does not change even if I press Refresh in JVisualVM. Same in JConsole
> > (not that it makes any difference, it's all JMX).
> >
> > How are these metrics updated? Nothing related to advisory messages
> > right?
> >
> > BR,
> > - Simon
> >
> > On Wed, 2022-02-09 at 13:01:57 +0100, Matt Pavlovich wrote:
> >> Hello Simon-
> >>
> >> Those JMX counter metrics most definitely change. If you are using
> tool, such as console you may need to click ‘Refresh’ as data is going
> through.
> >>
> >> -Matt Pavlovich
> >>
> >>> On Feb 9, 2022, at 4:10 AM, Simon Lundström <si...@su.se> wrote:
> >>>
> >>> Hey all!
> >>>
> >>> Via JMX you can fetch metrics about e.g. queues in ActiveMQ Classic. So
> >>> the queue somequeue have the EnqueueCount attribute at
> >>> org.apache.activemq:type=Broker,brokerName=activemq.su.se
> ,destinationType=Queue,destinationName=somequeue
> >>> which contains the number of messages enqueued to the queue.
> >>>
> >>> However for topics the EnqueueCount does not move and I can't find any
> >>> other attribute that moves either.
> >>>
> >>> How can I see how many messages are or has been sent to a topic?
> >>>
> >>> BR,
> >>> - Simon
> >>
>
>

Re: ActiveMQ Classic topic JMX metrics

Posted by Matt Pavlovich <ma...@gmail.com>.
How are you sending messages to the broker?

> On Feb 9, 2022, at 11:12 AM, Simon Lundström <si...@su.se> wrote:
> 
> If you are talking about /amq/admin/topics.jsp when you say console it's
> all zeroes.
> 
> org.apache.activemq:type=Broker,brokerName=activemq.it.su.se,destinationType=Topic,destinationName=exampletopic
> does not change even if I press Refresh in JVisualVM. Same in JConsole
> (not that it makes any difference, it's all JMX).
> 
> How are these metrics updated? Nothing related to advisory messages
> right?
> 
> BR,
> - Simon
> 
> On Wed, 2022-02-09 at 13:01:57 +0100, Matt Pavlovich wrote:
>> Hello Simon-
>> 
>> Those JMX counter metrics most definitely change. If you are using tool, such as console you may need to click ‘Refresh’ as data is going through.
>> 
>> -Matt Pavlovich
>> 
>>> On Feb 9, 2022, at 4:10 AM, Simon Lundström <si...@su.se> wrote:
>>> 
>>> Hey all!
>>> 
>>> Via JMX you can fetch metrics about e.g. queues in ActiveMQ Classic. So
>>> the queue somequeue have the EnqueueCount attribute at
>>> org.apache.activemq:type=Broker,brokerName=activemq.su.se,destinationType=Queue,destinationName=somequeue
>>> which contains the number of messages enqueued to the queue.
>>> 
>>> However for topics the EnqueueCount does not move and I can't find any
>>> other attribute that moves either.
>>> 
>>> How can I see how many messages are or has been sent to a topic?
>>> 
>>> BR,
>>> - Simon
>> 


Re: ActiveMQ Classic topic JMX metrics

Posted by Simon Lundström <si...@su.se>.
If you are talking about /amq/admin/topics.jsp when you say console it's
all zeroes.

org.apache.activemq:type=Broker,brokerName=activemq.it.su.se,destinationType=Topic,destinationName=exampletopic
does not change even if I press Refresh in JVisualVM. Same in JConsole
(not that it makes any difference, it's all JMX).

How are these metrics updated? Nothing related to advisory messages
right?

BR,
- Simon

On Wed, 2022-02-09 at 13:01:57 +0100, Matt Pavlovich wrote:
> Hello Simon-
> 
> Those JMX counter metrics most definitely change. If you are using tool, such as console you may need to click ‘Refresh’ as data is going through.
> 
> -Matt Pavlovich
> 
> > On Feb 9, 2022, at 4:10 AM, Simon Lundström <si...@su.se> wrote:
> > 
> > Hey all!
> > 
> > Via JMX you can fetch metrics about e.g. queues in ActiveMQ Classic. So
> > the queue somequeue have the EnqueueCount attribute at
> > org.apache.activemq:type=Broker,brokerName=activemq.su.se,destinationType=Queue,destinationName=somequeue
> > which contains the number of messages enqueued to the queue.
> > 
> > However for topics the EnqueueCount does not move and I can't find any
> > other attribute that moves either.
> > 
> > How can I see how many messages are or has been sent to a topic?
> > 
> > BR,
> > - Simon
> 

Re: ActiveMQ Classic topic JMX metrics

Posted by Matt Pavlovich <ma...@gmail.com>.
Hello Simon-

Those JMX counter metrics most definitely change. If you are using tool, such as console you may need to click ‘Refresh’ as data is going through.

-Matt Pavlovich

> On Feb 9, 2022, at 4:10 AM, Simon Lundström <si...@su.se> wrote:
> 
> Hey all!
> 
> Via JMX you can fetch metrics about e.g. queues in ActiveMQ Classic. So
> the queue somequeue have the EnqueueCount attribute at
> org.apache.activemq:type=Broker,brokerName=activemq.su.se,destinationType=Queue,destinationName=somequeue
> which contains the number of messages enqueued to the queue.
> 
> However for topics the EnqueueCount does not move and I can't find any
> other attribute that moves either.
> 
> How can I see how many messages are or has been sent to a topic?
> 
> BR,
> - Simon


Re: ActiveMQ Classic topic JMX metrics

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi Simon,

Do you refresh the MBean attributes ? JMX is “static”, so the client has to refresh the attributes.

Regards
JB

> Le 9 févr. 2022 à 11:10, Simon Lundström <si...@su.se> a écrit :
> 
> Hey all!
> 
> Via JMX you can fetch metrics about e.g. queues in ActiveMQ Classic. So
> the queue somequeue have the EnqueueCount attribute at
> org.apache.activemq:type=Broker,brokerName=activemq.su.se,destinationType=Queue,destinationName=somequeue
> which contains the number of messages enqueued to the queue.
> 
> However for topics the EnqueueCount does not move and I can't find any
> other attribute that moves either.
> 
> How can I see how many messages are or has been sent to a topic?
> 
> BR,
> - Simon