ActiveMQ: Get list of connections through JMX?

十年热恋 提交于 2019-12-23 18:43:11

问题


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:

Example ObjectName of a connection: org.apache.activemq:BrokerName=localhost,Type=Connection,ConnectorName=openwire,Connection=toto

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);

回答1:


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()); 
} 


来源:https://stackoverflow.com/questions/7431734/activemq-get-list-of-connections-through-jmx

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!