One small piece of functionality that was easy to miss in the deluge of new function in MQ 9.1.0 is the ability to programmatically detect if a queue manager was licensed for MQ Advanced or not. From 9.1.0 queue managers have a queue manager level attribute called ADVCAP. If a queue manager has been enabled for MQ Advanced on Distributed, or MQ Advanced VUE on z/OS, then the value of ADVCAP will be ENABLED as shown below:




This attribute can also be queried programmatically via PCF using the inquire queue manager command.

But what if you are writing a JMS application and want to know if you are connected to an MQ Advanced (MQ Advanced VUE on z/OS) queue manager? Well one approach you can take is to use PCF, but there is a simpler way. If you are using the MQ 9.1.0 JMS client you can use the following code:

//Connect to queue manager in client mode.
MQConnectionFactory cf = new MQConnectionFactory();
cf.setConnectionNameList(“host(port)”);
cf.setTransportType(CommonConstants.WMQ_CM_CLIENT);

MQConnection c = (MQConnection) cf.createConnection();

//Prints “ADVCAP = true” for ADVCAP(ENABLED) queue managers,
//“ADVCAP = false” otherwise.
System.out.println(“ADVCAP = c.getBooleanProperty(CommonConstants.WMQ_CAPABILITY_ADVANCED)”);

There are a growing number of capabilities, for example the MQ Bridge to Blockchain, which are only available for MQ Advanced (MQ Advanced VUE on z/OS) queue managers. So being able to detect what type of queue manager you are connecting to is useful.

One thing that is worth bearing in mind is that this approach won’t work if running inside WebSphere Application Server, either traditional WAS, or WebSphere Liberty Profile.

If you have any questions about this reach out to me at lemingma@uk.ibm.com.

2 comments on"Detecting MQ Advanced, or MQ Advanced VUE, queue managers programmatically"

  1. I thought ADVCAP was introduced in V9.0.4 and V9.0.5 on z/OS and Distributed respectively? Is this something else introduced in V9.1.0? You suggest a programmatic interface change other than PCF and show a JMS example. This appears to also be available via MQINQ but isn’t documented as such. The constant used for PCF (MQIA_ADVANCED_CAPABILITY) also works in MQINQ (in V9.0.5 too). Perhaps you can get it added to this section in KC? [https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.ref.dev.doc/q101960_.htm]

    • Hi Morag,

      Correct the function was originally added in the CD stream. But most customers will only be likely to exploit it in LTS so I was glossing over that for simplicity.

      I will get the MQINQ doc updated.

      Cheers, Matt.

Join The Discussion

Your email address will not be published.