You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by AndrewB <a....@gmail.com> on 2011/09/15 15:12:08 UTC
Get list of connections through JMX?
Hello
how do I get the list of the connections to the OpenWire connector?
JConsole is able to list the connections, but i don't see which "view" I can
use to get the list:
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);
Thank you for the help!
Best regards
Andrew
--
View this message in context: http://activemq.2283324.n4.nabble.com/Get-list-of-connections-through-JMX-tp3815517p3815517.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Get list of connections through JMX?
Posted by AndrewB <a....@gmail.com>.
Hello
That does indeed work for me:
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());
}
Output:
2011-09-15 17:40:36,171 [main] ERROR - (root) - Name:
org.apache.activemq:BrokerName=localhost,Connection=toto,ConnectorName=openwire,Type=Connection
2011-09-15 17:40:36,171 [main] ERROR - (root) - Name:
org.apache.activemq:BrokerName=localhost,Connection=titi,ConnectorName=openwire,Type=Connection
Thank you very much!
Andrew
--
View this message in context: http://activemq.2283324.n4.nabble.com/Get-list-of-connections-through-JMX-tp3815517p3815975.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Get list of connections through JMX?
Posted by "flou@yahoo-inc.com" <fl...@yahoo-inc.com>.
Have you tried to use MBeanServerConnection.queryNames(ObjectName objName,
QueryExp query).
You need to construct ObjectName with wildcard for Connection ID:
new
ObjectName("org.apache.activemq:BrokerName="+brokerName+",Type=Connection,ConnectorName=openwire,Connection=*")
--
View this message in context: http://activemq.2283324.n4.nabble.com/Get-list-of-connections-through-JMX-tp3815517p3815719.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.