Websphere MQ check if object exists
I would like to use the Websphere MQ Java API to create channels, listeners, queues, etc. Is there a way of checking if a obje开发者_如何转开发ct of a given type, e.g. channel already exists on the queue manager?
If you are using the Java API then you will want to send Programmable Command Format (PCF) messages to the command server. Look for com.ibm.mq.pcf
in the MQ Javadoc for the API. In order to use these, you will need to refer often to the native PCF documentation.
To check existence of an object using PCF you would issue an inquire command against it. There are extensive PCF samples provided if you have performed a full install of the WMQ client or server. On Windows these live at C:\Program Files\IBM\WebSphere MQ\tools\pcf\samples
. Nearly all of the samples use a PCF inquire function of one type or another but PCF_ClearQueue.java
is probably the closest to what you are after.
Of course, if all you need is to check the existence of an object, just open it for inquire. If you get back a 2085 return code, the object does not exist.
If you have just copied the classes and need the full install to get the samples, it is freely downloadable as SupportPac MQC7. You definitely want to be using the v7 classes, even if the QMgr is at v6. WMQ v6 is end-of-life as of September 2011 and you get better integration of the PCF classes in v7 anyway..
精彩评论