获取WebSphere MQ消息头

时间:2014-09-16 11:52:09

标签: java ibm-mq

我想列出邮件的标题。但是当我使用IBM提供的代码时,永远不会输入循环:

...
int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF;
MQQueue queue = qMgr.accessQueue(qName, openOptions);
...
MQMessage rcvMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
queue.get(rcvMessage, gmo);
MQHeaderIterator it = new MQHeaderIterator(rcvMessage);
   while (it.hasNext()) {
      MQHeader header = it.nextHeader();
      System.out.println("Header type " + header.type() + ": " + header);
   }
...

有谁知道我的错误在哪里?

以下是使用qload阅读的消息:

A VER 2
A RPT 0
A MST 8
A EXP -1
A FDB 0
A ENC 273
A CCS 819
A FMT
A PRI 0
A PER 0
A MSI 414D5120574D42514D3144312020202035E2165414530020
A COI 000000000000000000000000000000000000000000000000
A BOC 0
A RTQ
A RTM WMBQM1D1
A USR lanes
A ACC 0000000000000000000000000000000000000000000000000000000000000000
A AID
A PAT 28
A PAN mq.MQ
A PTD 20140916
A PTT 11415704
A AOD
A GRP 000000000000000000000000000000000000000000000000
A MSQ 1
A OFF 0
A MSF 0
A ORL -1
X 000D48656C6C6F2C20576F726C6421

1 个答案:

答案 0 :(得分:1)

Calanais给出了答案:消息描述符不被归类为标题。

以下是table标题:

Header  Header Description  Format Name

MQCIH   CICS information header MQFMT_CICS
MQDLH   Dead-letter header  MQFMT_DEAD_LETTER_HEADER
MQDH    Distribution-list header    MQFMT_DIST_HEADER
MQEPH   Embedded PCF header MQFMT_EMBEDDED_PCF
MQIIH   IMS information header  MQFMT_IMS
MQMDE   Message-descriptor extension    MQFMT_MD_EXTENSION
MQCFH   PCF header  MQFMT_ADMIN / MQFMT_EVENT / MQFMT_PCF
MQRMH   Reference message header    MQFMT_REF_MSG_HEADER
MQRFH   Formatting header   MQFMT_RF_HEADER
MQRFH2  Version-2 rules and formatting header   MQFMT_RF_HEADER_2
MQWIH   Work information header MQFMT_WORK_INFO_HEADER
MQXQH   Transmission queue header   MQFMT_XMIT_Q_HEADER

如果您想阅读 MQMD字段,请参阅here