如何使用JMS API从WMQ访问RFH2 / usr文件夹

时间:2016-02-12 16:09:21

标签: jms ibm-mq

我有一个Java JMS应用程序,它从MQ队列中读取消息。我的应用程序可以成功读取消息并拉出JMS头(例如JMSDeliveryMode,JMSPriority等)和消息体,但我无法访问消息的<usr>文件夹部分。

我使用RFHutil将消息放在队列中。在RFH标签下,我正在勾选“包含RFH V2标头”#39;和&#39; usr&#39;,并在usr选项卡下我有test1 = 1。如果我使用MQExplorer浏览队列,我可以在消息中看到<usr><test1>1</test1></usr>,所以我认为我正确设置了usr文件夹。

我输出了整个message.getPropertyNames()枚举(正如主题JMS passing entire Application data <usr> block所讨论的那样,但我的usr字段不在那里。我的消息体也不包含我的usr字段。

我还读了MQ v7信息中心,你需要将WMQ_MESSAGE_BODY设置为WMQ_MESSAGE_BODY_MQ,但我使用的是v6MQ,并且不知道这是否相关/如何设置此值。

如何使用JMS API访问usr文件夹?

任何帮助/指针都会非常感激,因为我对JMS编程还不熟悉。

1 个答案:

答案 0 :(得分:0)

A first question is why is the USR folder of importance? Are you attempting to get your JMS application to interoperate with messages that put using another application that writes custom RFH2 headers.

RFHUtil is primarily used for test purposes.

MQ JMS originally used the RFH2 heasder to specifically send the JMS properties. Therefore the MQ JMS code reads the message, removes the RFH2 and processes it into a full JMS Message.

If you want the JMS API to fully read the RFH2, then the properties for reading the MQ message you've highlighted are correct. However those are not in MQ v6. Be aware that mq v6 and V7.0.1 are now out of support. Would strongly recommend that you investigate upgrading to MQ v8 - at minimum MQ 7.5.

CLients are freely downloadable if you are a developer and connecting to an estbalished QueueManager. Client versions don't have to match the QM.