DataPower MQ Put & Get Message Options (MQPMO / MQGMO)

8011547534_92142e8e41_b
Without setting the proper MQPMO / MQGMO options your MQ queues might begin to look like this.

Introduction

When creating a connection to MQ in DataPower, sometimes there is a need for fine-grained control over how the messages on the queue should behave. 

If you see weird behaviour in your queue then you may need to play with the MQ Get Message Options (MQGMO) or the MQ Put Message Options (MQPMO) defined on the connection. ‘Weird behaviour’ can include situations where successfully processed messages reappear in the source queue after a period of time (this is generally due to MQ sync point issues).

I’ve found it difficult to find a table that defines the meaning for the allowed values. The DataPower documentation only refers to the fact that they can be set and does not define the meaning of each attribute. For that reason, I’ve included them below from my research.

MQ Get Message Options (MQGMO)

Individual attribute documentation: Get Message Options

MQGMO-NO-WAIT 0
MQGMO-WAIT 1
MQGMO-SYNCPOINT 2
MQGMO-NO-SYNCPOINT 4
MQGMO-SET-SIGNAL 8
MQGMO-BROWSE-FIRST 16
MQGMO-BROWSE-NEXT 32
MQGMO-ACCEPT-TRUNCATED-MSG 64
MQGMO-MARK-SKIP-BACKOUT 128
MQGMO-MSG-UNDER-CURSOR 256
MQGMO-LOCK 512
MQGMO-UNLOCK 1024
MQGMO-BROWSE-MSG-UNDER-CURSOR 2048
MQGMO-SYNCPOINT-IF-PERSISTENT 4096
MQGMO-FAIL-IF-QUIESCING 8192
MQGMO-CONVERT 16384
MQGMO-LOGICAL-ORDER 32768
MQGMO-COMPLETE-MSG 65536
MQGMO-ALL-MSGS-AVAILABLE 131072
MQGMO-ALL-SEGMENTS-AVAILABLE 262144
MQGMO-DELETE-MSG 524288

MQ Put Message Options (MQPMO)

Individual attribute documentation: Put Message Options

MQPMO-NONE 0
MQPMO-SYNCPOINT 2
MQPMO-NO-SYNCPOINT 4
MQPMO-DEFAULT-CONTEXT 32
MQPMO-NEW-MSG-ID 64
MQPMO-NEW-CORREL-ID 128
MQPMO-PASS-IDENTITY-CONTEXT 256
MQPMO-PASS-ALL-CONTEXT 512
MQPMO-SET-IDENTITY-CONTEXT 1024
MQPMO-SET-ALL-CONTEXT 2048
MQPMO-ALTERNATE-USER-AUTHORITY 4096
MQPMO-FAIL-IF-QUIESCING 8192
MQPMO-NO-CONTEXT 16384
MQPMO-LOGICAL-ORDER 32768
MQPMO-RESOLVE-LOCAL-Q 262144

Combining Options

If you notice the values for PMO and GMO, they are all powers of 2. This happens because each option is a flag representing the option at the nth bit.

In order to enable multiple message options, simply add the values of the desired options together. For example, to enable both MQGMO-NO-SYNCPOINT and MQGMO-NO-WAIT simply add the values together and use the sum as the property value.

Using MQPMO and MQGMO

PMO and GMO are set by DataPower anytime a connection to an MQ Queue Manger to put or get a message from a queue is needed. In general, they are found as query string parameters on the URL. For example:

In the case of GMO for an MQ Front Side Handler, there is an attribute named ‘Get Message Options’ where the value is used. The default value is 1: MQGMO-WAIT.

Conclusion

MQGMO & MQPMO are used to set special properties on the consumption of messages from MQ Queues. Ensure that you are familiar with these options when using MQ and you will avoid having to spend time debugging ‘weird’ behaviour.

About the Author

Dan Zrobok

Twitter

Dan is the owner of Orange Specs Consulting, with over 14 years of experience working in enterprise systems integration. He is an advocate of the IBM DataPower Gateway platform and looks to improve environments that have embraced it. He also occasionally fights dragons with his three year old daughter Ruby, and newborn Clementine.

Share this Post