私はmessageId
についてのWebsphere MQ上の2つの一般的な質問があります。のWebsphere MQメッセージ
1)このフィールドは、キュー内の同期通信を実現するために使用することができますか?以下のソースコードの例では :検索されたメッセージはhello_world
メッセージのみ、このメッセージの正確な応答であろう
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);
は、より熟成がある場合でも、キュー内の他のすべてのメッセージを残す検索しますこの?
2)これが当てはまる場合、これは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は非同期として指定されています。一方の側では、producer - > channel - > consumerです.2つの別々のチャネルput_channelとget_channelを作成しても、 →非同期 – mKorbel