Priority

A program can assign a priority to a message when it puts the message on a queue (see Message priorities ). Messages of equal priority are stored in a queue in order of arrival, not the order in which they are committed.

The queue manager maintains queues either in strict FIFO (first in, first out) sequence, or in FIFO within priority sequence. This depends on the setting of the MsgDeliverySequence attribute of the queue. When a message arrives on a queue, it is inserted immediately following the last message that has the same priority.

Programs can either get the first message from a queue, or they can get a particular message from a queue, ignoring the priority of those messages. For example, a program might want to process the reply to a particular message that it sent earlier. For more information, see Getting a particular message.

If an application puts a sequence of messages on a queue, another application can retrieve those messages in the same order that they were put, provided:
  • The messages all have the same priority
  • The messages were all put within the same unit of work, or all put outside a unit of work
  • The queue is local to the putting application

If these conditions are not met, and the applications depend on the messages being retrieved in a certain order, the applications must either include sequencing information in the message data, or establish a means of acknowledging receipt of a message before the next one is sent.

[z/OS]On IBM® MQ for z/OS®, you can use the queue attribute, IndexType, to increase the speed of MQGET operations on the queue. For more information, see Type of index.