0
  1. Correlation of request and response message on Q1 i.e. If Q1 sends out 100 messages to Q2 and receives 100 messages back, Q1 should be able to correlate those 100 responses back to the request. This is to ensure that response is tied back to the correct request and correct response is sent back to calling application. We are using GUID for correlation id.
  2. Set the timeout property to 50 secs. This is to achieve if the response comes back within 50 secs, send the response back to calling application. If response comes back after 50 secs, send the timeout response to calling application.

I need to do a POC on it, please Help..

iprashant7
  • 134
  • 1
  • 2
  • 11

2 Answers2

1
  • Req/Resp matching : If your GUID is unique for each message then you can use the same to correlate request and response message. Other option is to get the message ID from the request and then set as correlation Id in the response message.

For more details check here:

IBM WebSphere MQ request/reply scenario

Sample: https://www.ibm.com/developerworks/community/blogs/messaging/entry/jms_request_reply_sample?lang=en

  • Timeout: You can specify the timeout in the receive method in JMS. The sample covers this. If you want to use C application, there are options available in MQGET call(MQGMO_WAIT with Wait Interval.)
Community
  • 1
  • 1
Umamahesh P
  • 1,224
  • 10
  • 14
  • The sample code uses JMS API for selecting messages using correlation ID. The problem with JMS API using message ID or correlation ID is that consumer needs to be (re)created every time a message needs to be received. So I would use MQ Java classes for selecting messages using message ID or correlation ID as consumer needs to be opened only once. – Shashi Mar 12 '16 at 12:07
  • @Umamaesh - Thanks for your help. It helps me a lot. Can you tell me how to set timeout property for MQ. You can read second scenario in question for understanding – iprashant7 Mar 15 '16 at 06:23
  • @iprashant7 - You can specify the timeout in the receive method. For example, Message receivedMessage = consumer.receive(35000); The consumer will wait for 35000 milli seconds. – Umamahesh P Mar 15 '16 at 07:56
0

I am able to correlate request response scenario using Spring DSL. With the help of camel, its preety easy.

 <route id="request12">
        <from uri="WebsphereMq:queue:Queue1"/>

        <to uri="bean:mycode"/>
        <process ref="msgProcessor"/>

        <to uri="WebsphereMq:queue:Queue2 requestTimeout=50s" pattern="InOut"/>

        <onException>

    <exception>
         org.apache.camel.ExchangeTimedOutException
    </exception>

        <transform>
             <simple>Exachange Timeout Error</simple>
                      </transform>
                     <to uri="seda:response"/>
                </onException>
            <to uri="seda:response"/> 

        </route> 

<route id="Response">
            <from uri="seda:response" />

           <to uri="WebsphereMq:queue:ResponseQ"/>

        </route>
iprashant7
  • 134
  • 1
  • 2
  • 11