如何使用IBM MQ库从WebSphrere MQ MQMD头中读取值 [英] How to read values out of the WebSphrere MQ MQMD header with the IBM MQ libraries

查看:106
本文介绍了如何使用IBM MQ库从WebSphrere MQ MQMD头中读取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将此代码段作为起点:

Let's take this code snippet as a starting point:

import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQException;
import com.ibm.mq.MQGetMessageOptions;
import com.ibm.mq.MQMessage;
...
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);

现在我想获取消息类型和队列管理器的回复。它不能太难,但我没有找到任何关于如何做到这一点。

Now I want to get the message type and the reply to queue manager for example. It can't be too hard but I did not find anything on how to do that.

推荐答案

如果你看一下JavaDoc对于MQMessage类( http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.javadoc.doc/WMQJavaClasses/com/ibm/mq/MQMessage.html

If you look at the JavaDoc for the MQMessage class (http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.javadoc.doc/WMQJavaClasses/com/ibm/mq/MQMessage.html)

它扩展了MQMD类( http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com。 ibm.mq.javadoc.doc / WMQJavaClasses / com / ibm / mq / MQMD.html

it extends the MQMD class (http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.javadoc.doc/WMQJavaClasses/com/ibm/mq/MQMD.html)

并且它具有所有MQMD值。所以这个代码例如会显示replyTo&类型值

and this has all the MQMD values on it.. so this code for example will show you the replyTo & type values

  System.out.println("MsgType="+ rcvMessage.messageType);
  System.out.println("ReplyToQ="+ rcvMessage.replyToQueueName);
  System.out.println("ReplyToQmgr="+ rcvMessage.replyToQueueManagerName);

这篇关于如何使用IBM MQ库从WebSphrere MQ MQMD头中读取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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