【发布时间】:2016-09-03 19:34:33
【问题描述】:
我正在使用 ActiveMQ ServiceMix,我希望在 java 中获得入队消息数/出队消息数等。我想要在 ActiveMQ 控制台中显示的值
Name Number Of Pending Messages Number Of Consumers Messages Enqueued Messages Dequeued Views Operations
Consumer.ID-10-147-244-247-15461c6c293-38-0.Vir... 0 2 13 13
Consumer.ID-10-147-244-247-15470570c61-108-0.Vi... 0 2 13 13
我想获取 Messages Enqueued 列 :)
我的程序开始与消费者和听众的会话。一切正常。
但为了监控,我写了一个 karaf 命令,它调用我的订阅对象(订阅包含会话/连接/队列等...)
在我的订阅中我试试这个:
ActiveMQConnection activeMQConnection = ((ActiveMQConnection) connection);
ActiveMQQueue activeMQQueue = getQueueConnection(queueName, activeMQConnection);
ActiveMQTopic a = AdvisorySupport.getConsumerAdvisoryTopic(activeMQQueue);
但接下来我不知道如何获取DestinationStatistics 以获取有关我的队列/主题的所有信息...
我也试试这个:
QueueBrowser queueBrowser = session.createBrowser(activeMQQueue);
但在浏览器中没有什么有趣的。
如果有人可以帮助我获得我的 DestinationStatistics 对象 ;)
非常感谢
【问题讨论】:
标签: java activemq apache-karaf apache-servicemix