activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Bain <>
Subject Re: Get Number of connection from all host to my activemq broker.
Date Fri, 14 Nov 2014 18:43:55 GMT
Configure the broker to expose JMX status (, if you haven't already done so.  Then
make sure you understand what's in the JMX beans; an easy way to do that is
to attach JConsole to the broker and navigate through the MBeans tab.  Once
you've done this, you should have a good idea of the algorithm you want to
use to actually gather up those beans, and all you should have questions
about is how to actually get them programmatically.  (If you've still got
questions about the algorithm you want to use, you need to figure that out
before you go any further.)

In your code, establish a connection to it (  Once you're
connected, you can get access to various MBean classes that correspond to
the different elements in the JMX tree you browsed in JConsole; the name of
the class is generally the name of the JMX element with "ViewMBean"
appended to it, such as BrokerViewMBean, ConnectionViewMBean, etc.

To get a set of MBean elements of a given type, you need to build a search
string, which is essentially the path you want to walk down the MBeans tree
you viewed in JConsole.  It will probably start with
"org.apache.activemq:type=Broker,brokerName=YOURBROKERNAME," and then will
continue from there (maybe you'll want to use "connector=clientConnectors"
to drill further, for example).  The things you can query for are
documented in the ActiveMQ JMX page I linked in the first paragraph.

That should be enough to put you on the right path, but I'll give you a
word of warning for two things I learned the hard way:
1)  The query format changed in 5.8.0 (as documented on the ActiveMQ JMX
page), and a lot of the blog posts that gave examples were using the
earlier format because they were written before 5.8.0 came out and don't
call out that they're using a format that's no longer applicable.  The
formats are pretty similar (and easy enough to translate between once you
realize there's a difference), but be aware if you look at older blog posts
that the query may not work if you just copy-and-paste.
2)  If I remember correctly, the query format is case-sensitive (and I
believe that one of the things that changed in 5.8.0 is capitalization of
some parts of the query), which can lead to frustration if you weren't
expecting it to matter.

Good luck.

On Fri, Nov 14, 2014 at 2:37 AM, Andreas Gies <>

> Hi
> if you want a view by host, you have to iterate over the Client Connection
> MBeans and group by the client’s address.
> Best regards
> Andreas
> > On 13 Nov 2014, at 18:04, bansalp <> wrote:
> >
> > I can get currentConnection count using activemq-admin query --view
> > CurrentConnectionsCount jmxurl.......
> >
> > But I want number of client from each host as well.
> >
> >
> > Thanks,
> > --bansalp
> >
> >
> >
> > --
> > View this message in context:
> > Sent from the ActiveMQ - User mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message