iprashant7
iprashant7

Reputation: 154

how to correlate request and reponse of Websphere MQ between two queues

  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..

Upvotes: 0

Views: 2306

Answers (2)

iprashant7
iprashant7

Reputation: 154

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>

Upvotes: 0

Umamahesh P
Umamahesh P

Reputation: 1244

  • 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.)

Upvotes: 1

Related Questions