Using Spring's JmsTemplate message.setStringProperty("param", "value")
one can set the value in MQRFH2.usr
. How can we set values in MQRFH2.other
?

- 10,239
- 2
- 19
- 38

- 1
- 1
-
Hi Priyank, why exactly do you want to set an 'other' folder ? MQ safe-keeps the JMS user properties in 'usr' so that when you have another MQ-JMS receiver on the other side it will know where to find the JMS user properties are. The fact that this folder is called 'usr' is just arbitrary. The important part is that if you send in a JMS message it comes out exactly like that (when viewed from JMS). – Axel Podehl Jan 14 '20 at 08:03
2 Answers
I'm not a JMS guy but I do know how to do it with regular MQ/Java API.
You use the MQRFH2 class and use the setFieldValue method:
rfh2.setFieldValue("other", "SomeText", "TEST");
I cannot find where I posted my program MQTest71.java on StackOverflow but you can find a write up on my blog here.
Update 2020/01/14:
This afternoon I played around with MQ/Java programs that created various folders in an MQRFH2 message and then ran MQ/JMS programs to retrieve the messages. MQ/JMS programs simply ignore all folders outside of 'mcd', 'jms' and 'usr'.
Therefore, you need to put the name/value properties in the 'usr' folder if you want MQ/JMS applications to access the information.

- 7,062
- 13
- 20
-
Will a MQ be able to inquire `SomeText` as a standard message property if it is in the `other` folder instead of the `usr` folder? – JoshMc Jan 13 '20 at 18:43
-
Hi @JoshMc, sure but the code will need to know where to find it. i.e. `String temp = rfh2.getStringFieldValue("other", "SomeText");` – Roger Jan 13 '20 at 23:01
-
So the queue manager will not make it a message property like if it was in `usr`? – JoshMc Jan 14 '20 at 00:37
-
@JoshMc, no. It will be a message property in folder "other". You can create your own folders for MQRFH2 (aka JMS) messages and they can contain any number of message properties. – Roger Jan 14 '20 at 16:54
-
Thank you Roger for the update. Is the other folder still present in the message or is the MQ Queue manager when internally consuming the RFH2 header and reproducing it just ignoring those folders and not sending them back out? – JoshMc Jan 14 '20 at 22:57
-
@JoshMc, the folders are still present but JMS application cannot get access to them. See https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.ref.dev.doc/q104150_.htm - that page implies that
can be used or any folder with content='properties' attribute but I could not get it to work with a JMS application – Roger Jan 15 '20 at 17:07
According to MQ 9.1.x>Reference>Developing applications reference>MQI applications reference>Properties specified as MQRFH2 elements>Supported MQRFH2 folders there is no other
folder.
The folders
<jms>
,<mcd>
,<mqext>
, and<usr>
are described in The MQRFH2 header and JMS. The<usr>
folder is used to transport any JMS application-defined properties that are associated with a message. Groups are not allowed in the<usr>
folder.

- 10,239
- 2
- 19
- 38