Summary: For an MQGET with the option of MQGMO_PROPERTIES_IN_HANDLE on a subscription, MQ does not honor the option when a message is published from an MQTT client. Note: This does not happen when a regular MQ client program publishes a message to the same topic.
Setup: MQ v22.214.171.124 (on Windows 64-bit) and the latest SupportPac MA9C.
I am using the ‘Sample.java’ from SupportPac MA9C. Note: I did not modify the ‘Sample.java’ program. I used it as is. It defaults to a topic string of ‘Sample/Java/v3’.
Note: I have not defined the topic in the queue manager.
So here’s my issue: when I run my MQ program that subscribes to a topic (‘Sample/Java/v3’) that the MQTT ‘Sample.java’ program (from SupportPac MA9C) is publishing to, the message is always an MQRFH2 message. Very weird.
MQ Code Snippet:
int openOptionsForGet = CMQC.MQSO_CREATE | CMQC.MQSO_FAIL_IF_QUIESCING | CMQC.MQSO_MANAGED | CMQC.MQSO_NON_DURABLE;
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = CMQC.MQGMO_PROPERTIES_IN_HANDLE | CMQC.MQGMO_FAIL_IF_QUIESCING;
MQMessage getMsg = new MQMessage();
MQQueueManager qMgr = new MQQueueManager("MQA1");
MQTopic subscriber = qMgr.accessTopic( "Sample/Java/v3",
The ‘getMsg’ message has a format of MQRFH2 with a single folder called: ‘mqtt’ with 3 elements: clientid, qos and msgid. There is 1 Named Property called: ‘mqps.Top’.
This is wrong. The message format should not be MQRFH2 but rather ‘blank’ and there should be 4 Named Properties: ‘mqtt.clientId’, ‘mqtt.qos’, ‘mqtt.msgid’ and ‘mqps.Top’.
But if I change the ‘gmo.options’ line to be:
gmo.options = CMQC.MQGMO_PROPERTIES_FORCE_MQRFH2 + CMQC.MQGMO_FAIL_IF_QUIESCING;
Then the ‘getMsg’ message has a format of MQRFH2 with 2 folders called: ‘mqtt’ and ‘mqps’. The ‘mqtt’ folder has the (same) 3 elements: clientid, qos and msgid. The ‘mqps’ folder has 1 element called ‘Top’. There are zero Named Properties. This is the expected result.
So, does anybody know why MQ would not honor the MQGET option of MQGMO_PROPERTIES_IN_HANDLE when the message originates from an MQTT client publisher?