使用Java从MQ队列获取RFH2 usr区域名称/值对 [英] Get RFH2 usr area name-value pairs from MQ queue using Java

查看:303
本文介绍了使用Java从MQ队列获取RFH2 usr区域名称/值对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Java,我想构建一个具有MQMD,RFH2 usr区域(具有很少的名称/值对)的MQ消息. 我能够连接到Qmgr并能够从一个队列中读取一条消息. 我想检索所有标头值(MQMD,RFH2 usr等),并根据检索到的消息构建一个这样的消息 谁能帮我这个忙吗?

Using Java, I want to build a MQ message that has MQMD,RFH2 usr area (with few name-value pairs). I am able to connect to Qmgr and able to read a message from one queue. I want to retrieve all header values (MQMD,RFH2 usr etc) and build one such message based on the retrieved message Can anyone please help me out in this ?

仅供参考:我正在使用Loadrunner工具进行负载测试,该工具将消息的负载放在入站队列中,它们将被处理并将发送到出站队列.该工具将读取出站队列的当前队列深度,以检查总处理时间.

FYI: I am doing a load testing using Loadrunner tool that puts loads of messages on inbound queue and they will be processed and will be sent to outbound queue. And the tool will read the current queue depth of the outbound queue to check the total processing time.

欢迎任何建议

图片: MQ邮件标题图片

MQRFH2上不受支持的版本

推荐答案

MQRFH2标头可以认为是一种心态.您可以具有带或不带MQRFH2标头的消息属性.

MQRFH2 header can be thought of as a state of mind. You can have message properties with or without an MQRFH2 header.

有一个名为此处.

There is a queue attribute called PROPCTL. You can read about it here.

从您的Java代码中,只需执行以下操作:

From your Java code, just do:

MQMessage msg = new MQMessage();
msg.setStringProperty("propName", "propValue");

或者如果您真的想花哨的话,请使用MQRFH2类.

or if you want to get really fancy, then use the MQRFH2 class.

MQMessage msg = new MQMessage();
MQRFH2 rfh2 = new MQRFH2();
rfh2.setFolderStrings(new String[]{"<d1>First</d1>", "<d2>Second</d2>", "<d3>Third</d3>"});
MQHeaderList putList = new MQHeaderList();
putList.add(rfh2);
msg.format = putList.updateHeaderChaining(CMQC.MQFMT_RF_HEADER_2);

就个人而言,第一个示例要容易得多且更清洁,但是,嘿,这就是我所希望的.

Personally, the first example is far easier and cleaner but hey, that's what I prefer.

这篇关于使用Java从MQ队列获取RFH2 usr区域名称/值对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆