How to remove MQ authorities for deleted ids

A userid or group deleted from the operating system still shows up in a queue manager’s authority lists. Ideally you would have removed those authorisations before deleting the id, but if you have not, then MQ will not usually let you delete the authorisations later. This post explains the procedure that I use to remove MQ authorities for deleted ids or to cold-start the authorisations when testing. I’ll also describe a second procedure that you might prefer.

There are both use-at-own-risk methods, but I’ve given an outline a few times in posts and replies elsewhere. After a bit of encouragement, I finally decided it might be better to give fuller details so you can make a proper evaluation of whether to use the technique.

Continue reading “How to remove MQ authorities for deleted ids”

This post was last updated on June 28th, 2022 at 04:25 pm

C switch statement efficiency

MQ V8 introduced a header file, cmqstrc.h, that maps constants in the MQI to string values. I’ve mentioned it a few times recently, both here and in some other forums. One question came in, asking about how well that code worked. So I’ve recreated some tests I wrote back in 2015, to demonstrate what compilers do with that pattern. This shows the efficiency of writing large switch statements in C.

Continue reading “C switch statement efficiency”

This post was last updated on February 25th, 2022 at 10:03 am

MQ and Node.js: an update to the TypeScript interface

I recently wrote an article about new TypeScript bindings for the MQ and Node.js interface. Version 0.9.21 of the MQ Node.js interface includes an update to the TypeScript definitions that can assist further in writing correct programs by describing how MQI flags or bitfield parameters are set. Showing how this new capability works was a bit too long to simply add to the original article. So I’ve written this piece.

Continue reading “MQ and Node.js: an update to the TypeScript interface”

This post was last updated on January 28th, 2022 at 07:43 pm

MQ and Node.js: working with TypeScript

MQ application programs for the Node.js environment can now use TypeScript definitions. This brings the opportunity to compile and check your JavaScript programs for correctness before running them. This post will talk more about what TypeScript is and how it can help your MQ Node.js development activity.

Substantial credit for the API definitions and translations of the example programs needs to be given to Andre, who submitted a Pull Request to our github repository.

Continue reading “MQ and Node.js: working with TypeScript”

This post was last updated on January 26th, 2022 at 01:53 pm

Resolving subscription authorisation failures

It never fails to amaze me how often the same question gets asked by different people from different projects at around the same time. This time, I was asked by two people about resolving subscription authorisation failures. I could find lots of information about IBM MQ publish/subscribe, and general descriptions of what security checks are made. But there was not so much on how to use information from the queue manager that can help to deal with the inevitable failures.

Continue reading “Resolving subscription authorisation failures”

This post was last updated on December 13th, 2021 at 01:23 pm

Decoding MQI constants

On Twitter, Michael asked: “any logic or hints on how to interpret the PCF parameter names returned as multiples from the com.ibm.mq.headers.pcf?” Which is a very good question but a proper answer is far too long to type there. There are several different ways that you can approach the problem, depending on what you are trying to do. So this post talks about decoding MQI constants.

Continue reading “Decoding MQI constants”

This post was last updated on March 21st, 2022 at 09:47 am

Event formatter changes with MQ 9.2.4

IBM has just announced MQ 9.2.4. No matter how hard you search the announcement letters you will still not be able to find anything about the event formatter changes that I was able to slip into the release. That’s because changes to samples don’t normally deserve highlighting in formal marketing documents. But I hope this change still turns out to be useful.

Continue reading “Event formatter changes with MQ 9.2.4”

This post was last updated on November 24th, 2021 at 01:12 pm

Warning: is it an error

Something I dealt with recently in independent exchanges with several different people was about programming with IBM MQ, and dealing with MQI errors that might not be errors. This post is a short discussion about the not-quite-failed status of a warning. Is it an error? What is the difference between MQI errors and warnings?

Continue reading “Warning: is it an error”

This post was last updated on November 15th, 2021 at 10:00 am

Controlling queue creation

A recent thread on mqseries.net asked about controlling queue creation in MQ. In particular, how to set authorities so that one user can create queues like “ABC…” but not “DEF…”. There are answers given in that thread both on the ability to do it, and the reason why it’s not usually something that’s needed.

In summary, it’s not possible to control it with setmqaut commands. And since queue creation is usually done by administrators, there’s not really any need to restrict it further.

But the thread did remind me of some code I’d written a few years ago while considering the same question as part of a larger piece of work. And so I thought I’d dredge up that PoC and make it a bit more readable. It shows how you can, in fact, implement that level of control on platforms where you can install extensions to the MQ Authorisation interface.

Continue reading “Controlling queue creation”

Variation on a theme: an MQI mistake

Theme

One of the common mistakes that people make when they first start programming with the MQI can be seen in this pseudo-code example:

MQMD md = {MQMD_DEFAULT}
MQGMO gmo = {MQGMO_DEFAULT}
int bufsize = 128
PMQCHAR buf = malloc(bufsize)
do {
  MQGET(&md,&gmo,buf,bufsize))
} while (rc != MQRC_NO_MSG_AVAILABLE)

They complain that despite pre-loading the queue, only a single message is returned. Anyone reading this is likely to recognise immediately the problem: the MsgId of the first message is returned in the md variable. The next iteration of the loop tries to match that MsgID and doesn’t find any more messages.

There are aspects of the MQI that try to minimise your chances of getting this wrong, like the MatchOptions flag in the MQGMO structure. But that in turn requires you know a) to set it and b) override the default version of the structure.

Having worked with MQ for so many years, I am hopefully not going to make that kind of mistake. But I still got caught out recently by a very similar problem.

Continue reading “Variation on a theme: an MQI mistake”

This post was last updated on September 20th, 2021 at 08:17 am