You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Aneesh <cv...@yahoo.co.in> on 2011/06/14 14:56:57 UTC
Gathering the information of a Queue in Java
In the JMX Console when we click on a queue name link say
"BrokerName=localhost,Destination=dlq.queue,Type=Queue"
we will get a page (which lists Queue size, EnqueueCount, DequeueCount etc)
which describes the JMX MbeanView of the queue(ie dlq.queue) which we have
selected.
I need to get the same info in my java code.Is it possible?
Scenario is like this:
I have an instance of BrokerService with me.
I tried checking in the BrokerService and BrokerView (obtained as
brokerService.getAdminView())
but unable to find any suitable placeholders for getting a specific queue
information.
Tried invoking getDestinations() on the broker instance.It returned a list
of ActiveMQDestinations.
But that also doesnt have the MBean attributes which i need to check for a
specific Queue.
Please help me.
Thanks
Aneesh
--
View this message in context: http://activemq.2283324.n4.nabble.com/Gathering-the-information-of-a-Queue-in-Java-tp3596470p3596470.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Gathering the information of a Queue in Java
Posted by boday <be...@initekconsulting.com>.
here are my notes on doing
this...http://www.consulting-notes.com/2010/08/monitoring-and-managing-activemq-with.html
Aneesh wrote:
>
> I went through those, but still cant get it..
>
> I only have the BrokerService instance with me.
> From this instance i need to look up the attributes of a queue..
> is it possible?
>
> Basically from the junit files in the repository this is the way in whic
> we can get a QueueViewMbean instance of a queue;
>
> ObjectName queueViewMBeanName = assertRegisteredObjectName(domain +
> ":Type=Queue,Destination=" + getDestinationString() +
> ",BrokerName=localhost");
>
> QueueViewMBean queue =
> (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
> queueViewMBeanName, QueueViewMBean.class, true);
>
>
> How can i obtain this from the BrokerService instance?
> I cant get the MBeanServer from the BrokerService
> Any suggestions will be really helpful..
>
> Thanks
>
--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-Gather-the-information-of-a-Queue-in-Java-tp3596470p3603061.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Gathering the information of a Queue in Java
Posted by Aneesh <cv...@yahoo.co.in>.
I went through those, but still cant get it..
I only have the BrokerService instance with me.
>From this instance i need to look up the attributes of a queue..
is it possible?
Basically from the junit files in the repository this is the way in whic we
can get a QueueViewMbean instance of a queue;
ObjectName queueViewMBeanName = assertRegisteredObjectName(domain +
":Type=Queue,Destination=" + getDestinationString() +
",BrokerName=localhost");
QueueViewMBean queue =
(QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
queueViewMBeanName, QueueViewMBean.class, true);
How can i obtain this from the BrokerService instance?
I cant get the MBeanServer from the BrokerService
Any suggestions will be really helpful..
Thanks
--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-Gather-the-information-of-a-Queue-in-Java-tp3596470p3602298.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Gathering the information of a Queue in Java
Posted by Dejan Bosanac <de...@nighttale.net>.
There are a lot of examples on how to get broker data using JMX in unit
tests. Take a look at this one for example
https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SecurityJMXTest.java?hb=true
<https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/security/SecurityJMXTest.java?hb=true>
Regards
--
Dejan Bosanac - http://twitter.com/dejanb
-----------------
The experts in open source integration and messaging - http://fusesource.com
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net
On Tue, Jun 14, 2011 at 2:56 PM, Aneesh <cv...@yahoo.co.in> wrote:
> In the JMX Console when we click on a queue name link say
> "BrokerName=localhost,Destination=dlq.queue,Type=Queue"
> we will get a page (which lists Queue size, EnqueueCount, DequeueCount etc)
> which describes the JMX MbeanView of the queue(ie dlq.queue) which we have
> selected.
>
> I need to get the same info in my java code.Is it possible?
>
> Scenario is like this:
> I have an instance of BrokerService with me.
> I tried checking in the BrokerService and BrokerView (obtained as
> brokerService.getAdminView())
> but unable to find any suitable placeholders for getting a specific queue
> information.
> Tried invoking getDestinations() on the broker instance.It returned a list
> of ActiveMQDestinations.
> But that also doesnt have the MBean attributes which i need to check for a
> specific Queue.
> Please help me.
>
> Thanks
> Aneesh
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Gathering-the-information-of-a-Queue-in-Java-tp3596470p3596470.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>