将 WMQ7.0 与 WMB 6.1 一起使用
我有一个流程,我正在转换一条消息并使用MQRFH2.usr来保存一些数据。
但是,我面临MQRFH2.usr出现在主消息正文中的问题。
我在不同的环境中部署了相同的代码,但我只在一个环境中遇到了这个问题。
所以,这似乎不是代码问题。它与配置有关。
请提出可能的原因。
将 WMQ7.0 与 WMB 6.1 一起使用
我有一个流程,我正在转换一条消息并使用MQRFH2.usr来保存一些数据。
但是,我面临MQRFH2.usr出现在主消息正文中的问题。
我在不同的环境中部署了相同的代码,但我只在一个环境中遇到了这个问题。
所以,这似乎不是代码问题。它与配置有关。
请提出可能的原因。
Check the queue's PROPCTL
setting. If this is set to NONE
then the behavior is as follows:
If the application does not create a message handle, all the message properties are removed from the MQRFH2. Name/value pairs in the MQRFH2 headers are left in the message.
Be sure to read the doc page through a couple of times and maybe test with different settings to understand fully how PROPCTL
modifies the message content your app receives.
MQRFH2 标头(如果存在)始终位于消息的有效负载部分(这是 webpshere 组织它的方式)。您可以接收一个或多个 MQRFH2 标头(结构)。
也许您只期待一个并且正在收到两个?这将解释您的消息数据留下了乱码。
我使用以下代码在收到消息后处理这些听到的消息
MQRFH2 header = null;
// Find and store message length
int msglen = replyMessage.getMessageLength();
MQHeaderList list = new MQHeaderList(replyMessage);
int indexOf = list.indexOf("MQRFH2");
if (indexOf >= 0) {
header = (MQRFH2) list.get(indexOf);
msglen = msglen - header.size();
}
String msgText = replyMessage.readStringOfCharLength(msglen);
希望能帮助到你。
马丁斯