Websphere MQ 检查对象是否存在
我想使用Websphere MQ Java API 来创建通道、侦听器、队列等。有没有办法检查给定类型的对象(例如通道)是否已存在于队列管理器上?
I would like to use the Websphere MQ Java API to create channels, listeners, queues, etc. Is there a way of checking if a object of a given type, e.g. channel already exists on the queue manager?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 Java API,那么您将需要向命令服务器发送可编程命令格式 (PCF) 消息。在 API 的 MQ Javadoc。为了使用它们,您需要经常参考本机 PCF 文档。
要使用 PCF 检查对象是否存在,您需要对其发出查询命令。如果您已执行 WMQ 客户端或服务器的完整安装,则会提供大量 PCF 示例。在 Windows 上,它们位于
C:\Program Files\IBM\WebSphere MQ\tools\pcf\samples
。几乎所有示例都使用一种或另一种类型的 PCF 查询函数,但PCF_ClearQueue.java
可能最接近您所追求的功能。当然,如果你只是需要检查一个对象是否存在,只需打开它进行查询即可。如果返回 2085 返回码,则该对象不存在。
如果您刚刚复制了这些类并需要完整安装来获取示例,则可以免费下载 SupportPac MQC7。您肯定希望使用 v7 类,即使 QMgr 是 v6。 WMQ v6 已于 2011 年 9 月终止生命周期,无论如何您都可以更好地集成 v7 中的 PCF 类。
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 butPCF_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..