I just use JMX to get these statistics...
here is some raw code to create a connection and iterate over the AMQ queues
to find a given queues size...
note: be careful to close/resuse JMX connections or they will cause
OutOfMemoryExceptions on the MBeanServer
...
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" +
machineName + ":" + port
+ "/jmxrmi");
JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
conn = jmxc.getMBeanServerConnection();
ObjectName activeMQ = new
ObjectName("org.apache.activemq:BrokerName=localhost,Type=Broker");
BrokerViewMBean mbean = (BrokerViewMBean)
MBeanServerInvocationHandler.newProxyInstance(mbsc, activeMQ,
BrokerViewMBean.class, true);
//find the queue in question and return the size
for (ObjectName name : mbean.getQueues())
{
QueueViewMBean queueMbean = (QueueViewMBean)
MBeanServerInvocationHandler.newProxyInstance(mbsc,
name,QueueViewMBean.class, true);
if (queueMbean.getName().equals(queueName))
{
return queueMbean.getQueueSize();
}
}
-----
Ben - Senior Consultant
using SMX 3.3.1/Camel 2.1
--
View this message in context:
http://old.nabble.com/Issue-trying-to-browse-a-activemq-queue-tp27014479p27026944.html
Sent from the Camel - Users mailing list archive at Nabble.com.