How to identify the websphere MQ listner port is down from code level
I want to monitor mq listener status whether is up or down. If the connection is down i want to track it down and made a changes accordingly through my program. Is there a way to achieve 开发者_开发问答this using java ?
I would consider monitoring your listener this way if using Websphere MQ :
You can send messages to your listener with Programmable Command Formats known as websphere PCF.
Possible Uses
These PCF classes can be used to develop applications for general-purpose WebSphere MQ administration and monitoring, or in specialized applications that need to query or alter WebSphere MQ definitions.
http://www-01.ibm.com/support/docview.wss?uid=swg24000668
You can also use MBeans (we did in the past before we switched to SIBus). At one time the MBean type was named "ListenerPort".
If you want to use Java code you can access the AdminClient through a jar. For WebSphere version 7, it looks like that class is in the com.ibm.ws.admin.core.jar (should be somewhere in your WebSphere installation, or even in your install for Rational Application Developer or Rational Software Architect, if you use either of those).
Anyway, once you've looked up the MBean you want to run
//instance of AdminClient
adminClient.invoke(mBean, "start", null, null);
That's how we did it.
精彩评论