ActiveMQ:获取通过JMX的连接列表? [英] ActiveMQ: Get list of connections through JMX?
本文介绍了ActiveMQ:获取通过JMX的连接列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取与ActiveMQ的OpenWire连接器的连接列表?
JConsole能够列出连接,但是我看不到可以使用哪个视图来获得列表:
how do I get the list of the connections to the OpenWire connector of ActiveMQ? JConsole is able to list the connections, but I don't see which "view" I can use to get the list:
示例连接的对象名称:
org.apache.activemq:BrokerName = localhost,Type = Connection,ConnectorName = openwire,Connection = toto
Example ObjectName of a connection: org.apache.activemq:BrokerName=localhost,Type=Connection,ConnectorName=openwire,Connection=toto
我尝试了 ConnectorViewMBean,但操作它不允许我列出连接:
I tried "ConnectorViewMBean" but the operations on it don't allow me to list the connections:
ObjectName name = new ObjectName("org.apache.activemq:BrokerName=localhost,Type=Connection,ConnectorName=openwire");
mbsc.getMBeanInfo(name);
ConnectorViewMBean view = JMX.newMBeanProxy(mbsc, name, ConnectorViewMBean.class);
推荐答案
解决方案是使用表达式:
The solution was the usage of an expression:
ObjectName connectionNames =
new ObjectName("org.apache.activemq:BrokerName=localhost," +
"Type=Connection,ConnectorName=openwire,Connection=*");
Set<ObjectName> names = mbsc.queryNames(connectionNames, null);
for(ObjectName name : names) {
logger.error("Name: "+name.getCanonicalName());
}
这篇关于ActiveMQ:获取通过JMX的连接列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文