Selectors and message properties

Messages can have metadata associated with them alongside the main message payload. These message properties can be useful in supplying additional data.

There are two aspects to this additional data that it is important to know about:

  • The properties are not subject to Advanced Message Security (AMS) protection. If you want to use AMS to protect your data, then put it in the payload and not the message properties.
  • The properties can be used to perform the selection of messages.

It is important to note that using selectors breaks the standard message convention of first in first out. As the queue manager is optimized for this workload, providing complex selectors is not advised for performance reasons. The queue manager does not store indexes of the message properties, therefore searching for a message must be a linear search. The deeper the queue, the more complex the selector, and the lower probability that the selector matching a message will adversely affect performance.

If complex selection is required, it is suggested to filter the messages by using any application or processing engine, such as IBM® Integration Bus, to different destinations. Alternatively, the use of a topic hierarchy might be useful.

Note: IBM MQ classes for Java do not support the use of selectors, if we do wish to use selectors these should be done via the JMS API.