Author |
Message
|
anveshita |
Posted: Mon Jan 23, 2012 8:11 am Post subject: sending reply to specific queue in a cluster |
|
|
Master
Joined: 27 Sep 2004 Posts: 254 Location: Jambudweepam
|
I have the following set up.
I have two queue managers qm_A, qm_B,qm_c shared in the cluster. Have two queues reqest1, reply2 shared in the cluster.
Following is the set up:
qm_A has queue reply2
qm_B has queue reply2
qm_c has queue request1
qm_a, qm_b and qm_c are in cluster.
App1 connects to qm_A ,posts messages to request1 queue and listens for reply message on queue reply2 qm_A.
App2 connects to qm_B ,posts messages to request1 queue and listens for reply message on queue reply2 qm_B.
App3 connects to qm_c, gets the messages from request1 queue, processes the messages and posts message back to reply2 queue.
Now what I need is, for the request messages coming from App1 via qm_A, I need the response messages to go back to the same qm_B and queue reply2.
Same need to happen to the messages coming from App2 and the reply need to go to qm_B .
I looked at the following thread which speaks about sending the request to particular queue.
http://www.mqseries.net/phpBB/viewtopic.php?p=273741&sid=772001816d620ad4a8626a30808b5a46
One way I thought to handle this is: set replyq='reply2' and replyqmgr='qm_a" for the messages coming out of App1. App3 picks up the message and sets the mq description correctly and send the response back so that the response goes to qm_A.
However this seems to be not working. The messages are getting routed to qm_A and qm_B in round robin fashion. Am I missing anything with the above approach? Please let me know |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
mqjeff |
Posted: Mon Jan 23, 2012 8:13 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The application sending the reply is not doing the correct thing.
It needs to use the replyq and replytoqmgr fields. It's not. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Vitor |
Posted: Mon Jan 23, 2012 8:14 am Post subject: Re: sending reply to specific queue in a cluster |
|
|
![](images/avatars/905340816499abc1cdfb07.jpg) Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
anveshita wrote: |
App3 picks up the message and sets the mq description correctly and send the response back so that the response goes to qm_A. |
As indicated in the thread you quoted, it's not the message description that needs to be set. It's the object descriptor on the put. You shouldn't need to set the ReplyToQmgr in the original request either; it's filled out automatically. If you are, and you're setting it wrong, that's not going to help. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
anveshita |
Posted: Mon Jan 23, 2012 9:44 am Post subject: |
|
|
Master
Joined: 27 Sep 2004 Posts: 254 Location: Jambudweepam
|
Thanks. So basically App3 needs to make connection to "replyqmgr" and "replyq" which in this case is "qm_A" and "reply2" if the message is received from App1. Right? |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
mqjeff |
Posted: Mon Jan 23, 2012 9:49 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
app3 needs to MQOPEN and specify that the ObjectQname is the RepyToQueue and the ObjectQmgr is the ReplyToQmgr. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Vitor |
Posted: Mon Jan 23, 2012 10:14 am Post subject: |
|
|
![](images/avatars/905340816499abc1cdfb07.jpg) Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
anveshita wrote: |
Thanks. So basically App3 needs to make connection to "replyqmgr" and "replyq" which in this case is "qm_A" and "reply2" if the message is received from App1. Right? |
Wrong. It doesn't want to connect to anything except it's own queue manager, it needs to address the reply correctly. To do this, it needs to honour the reply information in the MQMD attached to the request rather than interogate which instance of the application sent it. This way it will continue to work unmodified when you scale up and add more instances of the requesting app on qm_X, qm_Y & qm_Z. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
anveshita |
Posted: Mon Jan 23, 2012 1:56 pm Post subject: |
|
|
Master
Joined: 27 Sep 2004 Posts: 254 Location: Jambudweepam
|
Vitor wrote: |
anveshita wrote: |
Thanks. So basically App3 needs to make connection to "replyqmgr" and "replyq" which in this case is "qm_A" and "reply2" if the message is received from App1. Right? |
Wrong. It doesn't want to connect to anything except it's own queue manager, it needs to address the reply correctly. To do this, it needs to honour the reply information in the MQMD attached to the request rather than interogate which instance of the application sent it. This way it will continue to work unmodified when you scale up and add more instances of the requesting app on qm_X, qm_Y & qm_Z. |
I think I am confused between the two responses @mqjeff and @vitor.
Vitor:
App3 will access the MQMD information of the request message it recieves. Say it say replytoq="reply2" and replytoqm="qm_A". Based on what you are saying App3 will connect to "qm_c", but puts message to "reply2". Right? If so how does the cluster know which queue manager qm_A or qm_B should get it since "reply2" is defined on both qms.
I guess I did not understand. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
mqjeff |
Posted: Mon Jan 23, 2012 2:03 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
App 3 will MQCONN to qm_c.
App3 will then MQOPEN, and specify ObjectQname = ReplyToQ from the mqmd, and ObjectQmgrName = ReplyToQmgr from the mqmd.
Entirely separate calls. None of the information passed to MQCONN is relevant to the MQOPEN call, only the returned hObj is relevant.
Or, App3 can MQPUT1 and skip the MQOPEN, but again this will specify the ObjectQname and ObjectQmgr name based on the ReplyToQ and ReplyToQmgr from the mqmd, and has nothing to do with any information passed to the MQCONN. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
anveshita |
Posted: Mon Jan 23, 2012 2:09 pm Post subject: |
|
|
Master
Joined: 27 Sep 2004 Posts: 254 Location: Jambudweepam
|
Thanks. That helps
mqjeff wrote: |
App 3 will MQCONN to qm_c.
App3 will then MQOPEN, and specify ObjectQname = ReplyToQ from the mqmd, and ObjectQmgrName = ReplyToQmgr from the mqmd.
Entirely separate calls. None of the information passed to MQCONN is relevant to the MQOPEN call, only the returned hObj is relevant.
Or, App3 can MQPUT1 and skip the MQOPEN, but again this will specify the ObjectQname and ObjectQmgr name based on the ReplyToQ and ReplyToQmgr from the mqmd, and has nothing to do with any information passed to the MQCONN. |
|
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
anveshita |
Posted: Fri Feb 03, 2012 10:54 am Post subject: |
|
|
Master
Joined: 27 Sep 2004 Posts: 254 Location: Jambudweepam
|
This is a follow up question. What will happen if you send the message to specific queue in a cluster by setting the MQOD and if the QM that hosts the queue is down while other qms shared in the cluster are available? Will the message be made available by the cluster so that the applications may be able to access the message from the other QM?
Ideally I should test it but I do not have access to MQ right now to build a test case. Please let me know |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
mqjeff |
Posted: Fri Feb 03, 2012 11:04 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
anveshita wrote: |
Will the message be made available by the cluster so that the applications may be able to access the message from the other QM? |
No.
Because you've specifically constructed the message to prevent this from happening, on purpose. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Vitor |
Posted: Fri Feb 03, 2012 11:25 am Post subject: |
|
|
![](images/avatars/905340816499abc1cdfb07.jpg) Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
anveshita wrote: |
What will happen if you send the message to specific queue in a cluster by setting the MQOD and if the QM that hosts the queue is down while other qms shared in the cluster are available? |
The same thing that happens in a point to point scenario when the target queue manager is down; it sits on a transmission queue waiting for the queue manager to come back up.
anveshita wrote: |
Will the message be made available by the cluster so that the applications may be able to access the message from the other QM? |
No, because you've overriden the cluster by specifying a specific destination. Typically you'd only use this for a reply message that needs to go back to a specific queue manager because that's where the application that made the request is sitting. That sort of reply message is useless to any other queue manager because no application is expecting it. In your example App2 will not process replies made in response to requests issued by App1 because it's not expecting them & doesn't know what the question was. So even if the cluster did what you proposed, it wouldn't help.
If the "reply" is more accurately a response to the first message & can be processed by any application instance (i.e. both App1 & App2 can handle it because there's state information in the reply) then why are you specifying a queue manager in the first place? Let the cluster handle it. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
|