简体   繁体   English

使用C-API的IBM MQ 7.5检查本地还是非本地集群队列

[英]IBM MQ 7.5 using C-API to check if local or non-local cluster queue

I have the following issue (simplified): 我有以下问题(简化):

Two queue managers - QM1 and QM2 - form a cluster. 两个队列管理器-QM1和QM2-组成一个集群。

QMgr QM1 QMgr QM1

  • alias queue Q1 with base queue Q1.L, which is a local cluster queue (ie defined on QM1) 具有基本队列Q1.L的别名队列Q1,它是本地群集队列(即在QM1上定义)
  • alias queue Q2 with base queue Q2.L, which is a non-local cluster queue (ie defined on QM2) 具有基本队列Q2.L的别名队列Q2,它是一个非本地群集队列(即,在QM2上定义)

QMgr QM2 QMgr QM2

  • local cluster queue Q2.L 本地集群队列Q2.L

I can open the alias queues for inquiry, request MQCA_BASE_Q_NAME and I get the base queues in both cases. 我可以打开别名队列进行查询,请求MQCA_BASE_Q_NAME,并且在两种情况下都可以获取基本队列。

I need to programatically find out, if this base queue is a local cluster queue or a remote (non-local) cluster queue. 我需要以编程方式找出此基本队列是本地群集队列还是远程(非本地)群集队列。 We are using C API (MQI). 我们正在使用C API(MQI)。

I open the base queue for inquiry and, based on this documentation: 我打开基本队列进行查询,并基于此文档:

http://www-01.ibm.com/support/knowledgecenter/#!/SSFKSJ_7.5.0/com.ibm.mq.ref.dev.doc/q101840_.htm (see Usage Notes - 4.) http://www-01.ibm.com/support/knowledgecenter/#!/SSFKSJ_7.5.0/com.ibm.mq.ref.dev.doc/q101840_.htm (请参阅使用说明-4.)

I can request only the following attributes: - MQCA_Q_DESC, MQCA_Q_NAME, MQIA_DEF_BIND, MQIA_DEF_PERSISTENCE, MQIA_DEF_PRIORITY, MQIA_INHIBIT_PUT, MQIA_Q_TYPE 我只能请求以下属性:-MQCA_Q_DESC,MQCA_Q_NAME,MQIA_DEF_BIND,MQIA_DEF_PERSISTENCE,MQIA_DEF_PRIORITY,MQIA_INHIBIT_PUT,MQIA_Q_TYPE

This works, but MQIA_Q_TYPE returns for a cluster queue MQQT_CLUSTER (7). 这可以工作,但是MQIA_Q_TYPE返回群集队列MQQT_CLUSTER(7)。 This is good - I know that I handle a cluster queue, but not enough - local or non-local? 很好-我知道我可以处理集群队列,但还不够-是本地还是非本地?

Checking the cmqc.h header, I can see some other interesting attribute selectors, unfortunatelly not working. 检查cmqc.h标头,我可以看到其他一些有趣的属性选择器,但不幸的是无法正常工作。 For example: MQIA_CLUSTER_Q_TYPE, but when passing in the selector vector for inquiry, getting back CompCode:2, Reason:2067 - Attribute selector not valid. 例如:MQIA_CLUSTER_Q_TYPE,但是在传递选择器向量进行查询时,返回CompCode:2,原因:2067-属性选择器无效。

In the PCF documentation this seems to be possible: 在PCF文档中,这似乎是可能的:

http://www-01.ibm.com/support/knowledgecenter/#!/SSFKSJ_7.5.0/com.ibm.mq.ref.adm.doc/q087800_.htm (Table 1, column Cluster queue) http://www-01.ibm.com/support/knowledgecenter/#!/SSFKSJ_7.5.0/com.ibm.mq.ref.adm.doc/q087800_.htm (表1,列集群队列)

Is this some limitation of C API? 这是C API的限制吗? Any workaround? 任何解决方法?

Cheers, Miro 干杯,米罗

I know what you want to do, but why you would want to do it is an interesting question. 我知道你想要做什么 ,但为什么你会想这样做,是一个有趣的问题。 I hope that what you are working on is instrumentation and monitoring rather than an application program. 我希望您正在从事的是检测和监视,而不是应用程序。 If a business application needs to know this information, then the design is almost certainly broken. 如果业务应用程序需要了解此信息,则几乎可以肯定该设计已损坏。 The whole idea of async messaging was to decouple the sender from the receiver of the message, and thus the need for the app to know or care whether the destination is local or not. 异步消息传递的整个思想是使发送者与消息的接收者脱钩,因此应用程序需要知道或关心目的地是否为本地。 This is why the API doesn't address your question - to do so for business apps breaks the async model. 这就是API无法解决您的问题的原因-对于企业应用程序而言,这样做会破坏异步模型。

That said, the simplest way is to use MQIA_CURRENT_Q_DEPTH and inquire on the queue depth. 也就是说,最简单的方法是使用MQIA_CURRENT_Q_DEPTH并查询队列深度。 If the queue is non-local, the call will fail. 如果队列不是本地队列,则调用将失败。

(Deleted the previous answer about using PCF to DIS QL since this is much simpler and 100% accurate.) (删除了先前关于使用PCF进行DIS QL的答案,因为这要简单得多,而且准确率达到100%。)

Of the 60 queue attributes available for inquiry, why do you believe that you "can request only the following attributes: - MQCA_Q_DESC, MQCA_Q_NAME, MQIA_DEF_BIND, MQIA_DEF_PERSISTENCE, MQIA_DEF_PRIORITY, MQIA_INHIBIT_PUT, MQIA_Q_TYPE"? 在60个可查询的队列属性中,为什么您认为“只能请求以下属性:-MQCA_Q_DESC,MQCA_Q_NAME,MQIA_DEF_BIND,MQIA_DEF_PERSISTENCE,MQIA_DEF_PRIORITY,MQIA_INHIBIT_PUT,MQIA_Q_TYPE”? Is this a local shop standard? 这是当地商店的标准吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM