ibm-messaging / mq-mqi-nodejs

Calling IBM MQ from Node.js - a JavaScript MQI wrapper
Apache License 2.0
79 stars 41 forks source link

Unable to query MQ version #150

Closed creasman closed 1 year ago

creasman commented 2 years ago

mq-mqi-nodejs version: ibmmq@1.0.1

I'm trying to use the mq.Inq command to query some basic information about the queue manager. After successfully opening a connection this is the query I am using:

        const selectors: mq.MQAttr[] = [
          new mq.MQAttr(MQC.MQCA_Q_MGR_NAME),
          new mq.MQAttr(MQC.MQCA_Q_MGR_IDENTIFIER),
          new mq.MQAttr(MQC.MQCA_VERSION),
          new mq.MQAttr(MQC.MQCA_CREATION_DATE),
          new mq.MQAttr(MQC.MQCA_CREATION_TIME),
        ];

        mq.Inq(hObj, selectors, (inqError: any) => {
          if (inqError) {
            console.log('Query failed');
          }
          console.log(JSON.stringify(selectors));
        });

This fails with the following error:

{
  name: "MQError",
  message: "INQ: MQCC = MQCC_FAILED [2] MQRC = Unknown [NaN]",
  mqcc: 2,
  mqccstr: "MQCC_FAILED",
  mqrc: undefined,
  mqrcstr: "Unknown",
  version: "1.0.1",
  verb: "INQ",
}

If I remove MQCA_VERSION from the selectors, then the inquire works and returns the expected information. I don't see any error messages on the queue manager console. That, and the lack of information returned for the other selectors, makes me think this request is failing on the client side.

Should this work? If not, is there a way to surface a better error message than 'Unknown [NaN]'? My goal is to get the version information of the queue manager and/or MQ server.

Thanks, Jim

ibmmqmet commented 2 years ago

That's the problem with relying on the documentation ... the list of valid MQCA_ attributes that this library understands was originally taken from the product docs but for some reason it doesn't list MQCA_VERSION. So I've added that, and a couple of other new items that should also be in there. And updated my build processes so hopefully this won't happen again with any new attributes.

creasman commented 2 years ago

Thanks! Appreciate the quick turnaround.