MQOPEN options for removing messages

 

Three options control the opening of a queue to remove messages from it. We can use only one of them in any MQOPEN call. These options define whether your program has exclusive or shared access to the queue. Exclusive access means that, until you close the queue, only we can remove messages from it. If another program attempts to open the queue to remove messages, its MQOPEN call fails. Shared access means that more than one program can remove messages from the queue.

The most advisable approach is to accept the type of access that was intended for the queue when the queue was defined. The queue definition involved the setting of the Shareability and the DefInputOpenOption attributes. To accept this access, use the MQOO_INPUT_AS_Q_DEF option. Refer to Table 1 to see how the setting of these attributes affects the type of access that you will be given when you use this option.

How queue attributes and options of the MQOPEN call affect access to queues
Queue attributes Type of access with MQOPEN options
Shareability DefInputOpenOption AS_Q_DEF SHARED EXCLUSIVE
SHAREABLE SHARED shared shared exclusive
SHAREABLE EXCLUSIVE exclusive shared exclusive
NOT_SHAREABLE* SHARED* exclusive exclusive exclusive
NOT_SHAREABLE EXCLUSIVE exclusive exclusive exclusive

* Although you can define a queue to have this combination of attributes, the default input open option is overridden by the shareability attribute.

Alternatively:

  1. We cannot remove messages from a remote queue. Therefore we cannot open a remote queue using any of the MQOO_INPUT_* options.

  2. We cannot specify this option when opening a distribution list. For further information, see Distribution lists.

 

Parent topic:

Using the options of the MQOPEN call


fg12220_