Using JMX interface to manage SIB queues
A service integration bus provides location transparent messaging, meaning that an application can connect to any bus member and send to (or receive from) a destination deployed to any bus member. The destination does not need to be deployed to the same bus member that the application connected to,
the bus routes the message to (or from) the destination. This section will describe how to use the Java application programming interfaces (APIs) in order to create a tool to navigate through the messaging components of a SIBus.
The code below will show how to view the current depth and message contents of all queues from all messaging engines. One can use this code via the AdminClient API (if the code will be used as a standalone) or via the MBeanServer API (if the code will be run inside a WebSphere JVM).
For a standalone application the first step is to create the AdminClient class in order to provide the client side APIs for the remote AdminService. This is shown below:
For a standalone application the first step is to create the AdminClient class in order to provide the client side APIs for the remote AdminService. This is shown below:
If the code will run inside a WebSphere JVM (i.e. as an MBean) then the following code should be used:
It should be noted in this regard that the above code should be run inside the Messaging infrastructure JVM if a deployment environment is used (not a single server in a single cell).
The next step is to find all SIBMessagingEngines:
The next step is to find all SIBMessagingEngines:
Then for each SIBMessagingEngine we are looking for all attached SIBQueuePoints:
For each SIBQueuePoint we are quering for the following attributes:
- depth
- state
- id
- highMessageThreshold
- sendAllowed
If the current depth of this SIBQueuePoint is greater than zero (could be greater than a specific threshold if you need to implement a simple monitor solution) then we get the queue messages:
For each message within a queue we print message attributes:
Then we print the queue message details:
Finally we print the message contents:
References
[1] IBM Information Center - “WebSphere Application Server Version 7.0 -Interface AdminClient" Date of access: June 2013. http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.javadoc.doc%2Fweb%2Fapidocs%2Fcom%2Fibm%2Fwebsphere%2Fmanagement%2FAdminClient.html
No comments:
Post a Comment