从命令行将消息放入MQ队列 [英] Put messages to MQ queue from command-line
问题描述
作为应用程序安装的一部分,我需要将一堆xml消息放入MQ队列中.为了使其更复杂,消息需要设置RFH2-header的usr文件夹.
As part of the installation of our application, I need to put a bunch of xml messages into an MQ queue. To make it more complicated, the messages need to have the usr-folder of the RFH2-header set.
我发现IBM RFHUtil的 mqput2.exe
是完成此任务的理想工具.不幸的是,我无法使usr-folder的设置生效,文档太含糊.我究竟做错了什么?或者,是否还有另一种更好的命令行工具可用?
I found that mqput2.exe
from the IBM RFHUtil is an ideal tool for this task. Unfortunately, I have been unable to make setting of the usr-folder work, the documentation is too vague. What am I doing wrong? Or, is there another command-line tool available that works better?
我的道具. mqput2
的文件看起来像这样:
My prop. file for mqput2
looks like this:
[header]
.....
*
* message type
*
* Allowed values for message type
* 1 - request
* 2 - reply
* 4 - report
* 8 - datagram
* 112 - MQE fields from MQE
* 113 - MQE fields
* 65536 to 999,999,999 - user
msgtype=8
.....
*
* rfh usage
* rfh = N for No rfh
* rfh = A for Automatic (look for RFH at beginning of data file)
* rfh = 1 or V1 for Version 1 rfh from parameters in parm file
* rfh = 2 or V2 for Version 2 rfh from parameters in parm file
* rfh = X for special V2 rfh with fixed portion only and format=xml
*
* only first character checked, except for V when second character is also checked
*
rfh=X
<usr>
<NotificationType>RDS.Codebook.Changes</NotificationType>
</usr>
.....
[filelist]
file1.xml
mqput2
只会忽略< usr>
部分,并且不将其包含在消息中.我也尝试过 rfh = A
并将< usr>
部分放在 file1.xml
文件的开头,但是后来我出现MQPUT错误 reason = 2142
(无效的MQ标头结构).
mqput2
simply ignores the <usr>
section and doesn't include it with the message. I've also tried rfh=A
and put the <usr>
section at the beginning of the file1.xml
file, but then I get MQPUT error reason=2142
(invalid MQ header structure).
推荐答案
我以这种方式进行设置,并且效果很好:
I have it set up this way, and it works fine:
[header]
qname=QName
qmgr=QMName
msgcount=1
format= "MQSTR "
codepage=1208
rfh=2
<usr>
<test>test</test>
</usr>
[filelist]
test.xml
这篇关于从命令行将消息放入MQ队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!