我已经关于messageId
在WebSphere MQ两个一般性问题:的WebSphere MQ消息
1)此字段可用于实现在一个队列中同步通信? 例如,在下面的源代码:
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!");
MQPutMessageOptions pmo = new MQPutMessageOptions();
system_default_local_queue.put(hello_world,pmo);
MQMessage retrievedMessage = new MQMessage();
retrievedMessage.messageId = hello_world.messageId;
MQGetMessageOptions gmo = new MQGetMessageOptions();
system_default_local_queue.get(retrievedMessage, gmo);
检索到的消息将是hello_world
消息,并且仅此消息将被检索离开所有的其它消息队列中,即使有超过老化的精确响应这个?
2)如果是这样的话可以这样用两个队列做了什么? 例子: 客户端:
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!");
MQPutMessageOptions pmo = new MQPutMessageOptions();
input_queue.put(hello_world,pmo);
MQMessage retrievedMessage = new MQMessage();
retrievedMessage.messageId = hello_world.messageId;
MQGetMessageOptions gmo = new MQGetMessageOptions();
output_queue.get(retrievedMessage, gmo);
服务器端:
while(true){
MQMessage inMessage= new MQMessage();
input_queue.get(mqMessage ,gmo);
//actions to get the contents of the inMessage and create proper response
MQMessage outMessage= new MQMessage();
//write the proper response to outMessage
outMessage.messageId = inMessage.messageId;
output_queue.put(outMessage, pmo);
}
Mq_queue被指定为默认异步,在一侧是生产者 - >信道 - >消费者,如果创建了两个分离的通道put_channel和get_channel,但message_flow仍保持不变第二例子是舒适用于数据流 - - >异步 – mKorbel 2012-01-16 22:53:16