-1

App1 – will send message to q1 App2 – will send message to q2

App1 will put message to q1 and App1 will get message from q2

q1 and q2 belongs to same queue manager and they are local queues

i wanted to know that how do i ensure that, i am getting response for same request Kindly let me know how and where do i maintain Id’s for request and response.

please do provide Code snippet or links where i can relate.

Currently what i am doing is generating Id from request message and putting it in Correlation id field while sending message; after getting response i am again generating Id using same formula (which i have used for request message id) and comparing both correlated id's if they match then Response is for same Request.

I have to immediately show the response to user so if there are multiple users currently logged in to Request Application then how to ensure that responses will match as per request. (as after reading message from queue queue will remove the message and even if i store it in database how to provide immediate response
to user)

please do provide some knowledge on this

Trupti
  • 19
  • 1
  • 5
  • Hi, I see you're relatively new to asking questions around here. You may want to read [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask) to help avoid downvotes – Basic Oct 12 '15 at 22:32

2 Answers2

0

Look at this response. If you are using XMS .NET, the following two samples shipped with product under <"mqinstall">\Tools\dotnet\samples\cs\xms\simple\wmq directory demonstrate the Request/Reply messaging pattern.

SimpleRequestor.cs -- Requester

SimpleRequestorServer.cs -- Responder

Community
  • 1
  • 1
Shashi
  • 14,980
  • 2
  • 33
  • 52
0

Standard practice is to remember the message Id of the request and look for it in the correlation Id of the response, and then to have the application that is responding copy the message Id from the request message into the correlation Id of the response. Read up on MQRO_COPY_MSG_ID_TO_CORREL_ID in Knowledge Centre (or elsewhere on the web that Google may point you at).

Your description is a little unclear as to whether you are using the message ID or correlation ID for the request message. You can of course choose to use correlation ID for both, and use MQRO_PASS_CORREL_ID instead. You just need to make sure your responding application does what it is told to do by the report option.

If you are passing the original request ID back in the response then you can compare the two and know that it is a response to a particular request message. This of course required each request message to have a unique message ID - something that IBM MQ will happily generate for you if you wish.

Morag Hughson
  • 7,255
  • 15
  • 44