You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by khandelwalanuj <an...@gmail.com> on 2016/07/19 11:51:31 UTC
Queue size from client side
Hi,
How to check Queue size from ActiveMQ java client ?
Thanks,
Anuj
--
View this message in context: http://activemq.2283324.n4.nabble.com/Queue-size-from-client-side-tp4714102.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Queue size from client side
Posted by Korny Sietsma <ko...@sietsma.com>.
I needed to find the master broker similarly, for our resiliency testing -
you can call connection.getBrokerInfo() (you might have to cast the
connection to ActiveMQConnection if you just have a JMS Connection object),
and then that exposes a pile of information like getBrokerURL() and
isMaster().
http://activemq.apache.org/maven/apidocs/org/apache/activemq/ActiveMQConnection.html#getBrokerInfo()
Mind you, I haven't tried this in a failover situation yet - I just use it
to verify the master broker when I start my tests, I don't use it to try to
tell if I've switched to a slave. But it should work.
As for getting queue depth, I think you can also use
session.createBrowser(queue) to create a QueueBrowser, that can then
enumerate all the messages on the queue without consuming them. Not sure
how expensive that is, presumably for a big queue using JMX would be much
faster; also of course the queue depth might give strange results when
there are transactions and writes and reads also happening.
- Korny
On 20 July 2016 at 09:36, khandelwalanuj <an...@gmail.com>
wrote:
> Problem with JMX is I can't specify failover url :
> "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi"
>
> I am using master slave topology and I don't know which broker is master
> and
> which is slave at any point of time, So I have to maintain the list of
> broker URLs and keep trying until connection is successful which is a lot
> to
> do just to get the Queue Size.
>
> I was wondering if there should be an easy API in ActiveMQ to get since
> this
> is a very basic requirement.
>
> Thanks,
> Anuj
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Queue-size-from-client-side-tp4714102p4714149.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
--
Kornelis Sietsma korny at my surname dot com http://korny.info
.fnord { display: none !important; }
Re: Queue size from client side
Posted by khandelwalanuj <an...@gmail.com>.
Problem with JMX is I can't specify failover url :
"service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi"
I am using master slave topology and I don't know which broker is master and
which is slave at any point of time, So I have to maintain the list of
broker URLs and keep trying until connection is successful which is a lot to
do just to get the Queue Size.
I was wondering if there should be an easy API in ActiveMQ to get since this
is a very basic requirement.
Thanks,
Anuj
--
View this message in context: http://activemq.2283324.n4.nabble.com/Queue-size-from-client-side-tp4714102p4714149.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Queue size from client side
Posted by Tim Bain <tb...@alumni.duke.edu>.
Or JMX? http://activemq.apache.org/jmx.html
On Jul 19, 2016 1:00 PM, "Quinn Stevenson" <qu...@pronoia-solutions.com>
wrote:
> Have you looked at the Statistics Plugin?
>
> http://activemq.apache.org/statisticsplugin.html <
> http://activemq.apache.org/statisticsplugin.html>
>
> > On Jul 19, 2016, at 5:51 AM, khandelwalanuj <
> anuj.cool.khandelwal@gmail.com> wrote:
> >
> > Hi,
> >
> > How to check Queue size from ActiveMQ java client ?
> >
> > Thanks,
> > Anuj
> >
> >
> >
> > --
> > View this message in context:
> http://activemq.2283324.n4.nabble.com/Queue-size-from-client-side-tp4714102.html
> > Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>
Re: Queue size from client side
Posted by khandelwalanuj <an...@gmail.com>.
Statistics plugin requires config changes in broker xml. I am looking for a
way to get the queueSize from the client side itself without changing
anything in broker.
Thanks,
Anuj
--
View this message in context: http://activemq.2283324.n4.nabble.com/Queue-size-from-client-side-tp4714102p4714142.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Queue size from client side
Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
Have you looked at the Statistics Plugin?
http://activemq.apache.org/statisticsplugin.html <http://activemq.apache.org/statisticsplugin.html>
> On Jul 19, 2016, at 5:51 AM, khandelwalanuj <an...@gmail.com> wrote:
>
> Hi,
>
> How to check Queue size from ActiveMQ java client ?
>
> Thanks,
> Anuj
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Queue-size-from-client-side-tp4714102.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.