简体   繁体   中英

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.

QMgr QM1

  • alias queue Q1 with base queue Q1.L, which is a local cluster queue (ie defined on QM1)
  • alias queue Q2 with base queue Q2.L, which is a non-local cluster queue (ie defined on QM2)

QMgr QM2

  • local cluster queue Q2.L

I can open the alias queues for inquiry, request MQCA_BASE_Q_NAME and I get the base queues in both cases.

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).

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.)

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

This works, but MQIA_Q_TYPE returns for a cluster queue 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. 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.

In the PCF documentation this seems to be possible:

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

Is this some limitation of 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.

That said, the simplest way is to use MQIA_CURRENT_Q_DEPTH and inquire on the queue 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.)

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"? Is this a local shop standard?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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