Need to get the messages passes through the sonic queue per minute

172 views Asked by At

I need to get the numver of messages passes through the sonic queue per minute via a java code. I need this so i can create an alert when this messages per minute is higher than normal count. Can some on please assist me with this. Thanks

1

There are 1 answers

0
Hassen Bennour On

this information should be available via JMX (enqueued/dequeued count).

try to connect to the broker with VisualVM to find the ObjectName and Attributes.

to access sonicmq by JMX :

Hashtable env = new Hashtable( );
env.put(“ConnectionURLs", "tcp://localhost:2506");
env.put("DefaultUser", "Administrator");
env.put("DefaultPassword", "Administrator");
JMSConnectorAddress address = new JMSConnectorAddress(env);
JMSConnectorClient connector = new JMSConnectorClient( );
connector.connect(address);
ObjectName brokerName = new ObjectName(“Domain1.Container1:ID=Broker1”);
MBeanInfo mi = connector.getMBeanInfo(brokerName );
... usual JMX attributes access