简体   繁体   English

如何跟踪WebSphere MQ上的消息回复?

[英]How do I track replies to messages on WebSphere MQ?

I am using Websphere MQ as an input and output inside a Broker Application Flow. 我使用Websphere MQ作为Broker应用程序流中的输入和输出。 The flow also has Websphere Transformation Extender Maps in them. 该流程还包含Websphere Transformation Extender Maps。

I want use java to send a message with a unique identifier on the input queue and receive a reply on the output queue. 我想使用java在输入队列上发送带有唯一标识符的消息,并在输出队列上接收回复。 I should be able to pick the message from the output queue using that unique identifier. 我应该能够使用该唯一标识符从输出队列中选择消息。

How can I do this? 我怎样才能做到这一点?

The easy way to do this is to use the CorrelationID. 执行此操作的简单方法是使用CorrelationID。

The application that is processing requests will need to copy the MessageID to the CorrelationID of the reply message when responding. 正在处理请求的应用程序需要在响应时将MessageID复制到回复消息的CorrelationID。 The requestor application specifies the CorrelationID as the message selector while receiving messages and provide the MessageID of the request message as the value for the selector. 请求者应用程序在接收消息时将CorrelationID指定为消息选择器,并将请求消息的MessageID作为选择器的值提供。

If you plan to use JMS, then it will be much simpler. 如果您打算使用JMS,那么它将更加简单。 Use the JMSMessageID and JMSCorrelationID properties and create a consumer with JMSCorrelationID as selector 使用JMSMessageID和JMSCorrelationID属性并使用JMSCorrelationID作为选择器创建使用者

QueueReceiver queueReceiver = session.createReceiver(destination, "JMSCorrelationID='+ requestMsg.JMSMessageID +"'"); QueueReceiver queueReceiver = session.createReceiver(destination,“JMSCorrelationID ='+ requestMsg.JMSMessageID +”'“);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM