Author |
Message
|
shifo_de |
Posted: Mon Jan 25, 2010 3:31 am Post subject: how to put a reply messsage in a cluster queue |
|
|
Newbie
Joined: 25 Jan 2010 Posts: 4
|
Hello,
Currently I’m trying to write a java MQ client that has to read the request-message from a remote-queue (specified by host, port, channel etc.) and to sent the reply to a manager and queue that are given in „replyToQ“ and „replyToMgr“ fields of the request-message.
Reading the request-message is not a problem but I do not know how to access the cluster-queue using only the replyToQ and replyToMgr.
Client Program and the MQSeries Server are not on the same host.
Thanks in advance for any help to this question. |
|
Back to top |
|
 |
Mr Butcher |
Posted: Mon Jan 25, 2010 3:36 am Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
you connect your java programm to QMGR X and read a message from one of that qmgr's queues. this message holds replytoq and replytoqmgr, so just "open that" on QMGR X, that qmgr should know about it. your program must not be aware of the fact that it is a cluster queue or not. _________________ Regards, Butcher |
|
Back to top |
|
 |
shifo_de |
Posted: Mon Jan 25, 2010 4:21 am Post subject: |
|
|
Newbie
Joined: 25 Jan 2010 Posts: 4
|
Hello Butcher,
thanks a lot fort he prompt reply. I do this actually with the following code:
…
mqManager = new MQQueueManager(managerReceive, envReceive);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF;
mqQueue = mqManager.accessQueue(nameGet, openOptions);
MQMessage mqMessage = createMQGetMessage();
MQGetMessageOptions mqOptions = createMQGetOptions();
mqQueue.get(mqMessage, mqOptions);
…
// get the reply queue and manager
replytoq = mqMessage.replyToQueueName;
replytomgr = mqMessage.replyToQueueManagerName;
// Prepare the reply-message
…
MQQueue mqQueueReply =
mqManager.accessQueue(replytoq, MQC.MQOO_OUTPUT, replytomgr, null, null);
mqQueueReply.put(mqMessageReply);
…
Is this the right approach in such type of communication? Does it require having MQ WebSphere Client software installed on the client machine?
Best Regards
vasil |
|
Back to top |
|
 |
Mr Butcher |
Posted: Mon Jan 25, 2010 5:34 am Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
you wrote
Quote: |
Client Program and the MQSeries Server are not on the same host |
.
yes, you need the mq client or the proper mq java classes.
sorry, i do not know much java language, so i can not verify your code. _________________ Regards, Butcher |
|
Back to top |
|
 |
shifo_de |
Posted: Mon Jan 25, 2010 6:10 am Post subject: |
|
|
Newbie
Joined: 25 Jan 2010 Posts: 4
|
ok 10x, I will test it now and will keep you in touch
regards
vasil |
|
Back to top |
|
 |
moonwalker |
Posted: Tue Jan 26, 2010 10:26 pm Post subject: |
|
|
 Apprentice
Joined: 02 Jun 2009 Posts: 42
|
Yes, Mr Butcher is absolutely correct. Just ensure that the queue manager you are talking about is part of the cluster. The queues that are shared in the cluster can be accessed just like you access the local queue of a queue manager. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jan 27, 2010 4:57 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
moonwalker wrote: |
The queues that are shared in the cluster can be accessed just like you access the local queue of a queue manager. |
Well, that's half right. |
|
Back to top |
|
 |
shifo_de |
Posted: Wed Jan 27, 2010 6:56 am Post subject: |
|
|
Newbie
Joined: 25 Jan 2010 Posts: 4
|
Well thanks to all for the replays. I'm getting the point now the next question is:
Is it possible to run this pease of code on a separate host (were no qmanager is installed but MQ WebSphere Client only)?
Or with other words: Is it possible to send a reply to "cluster-queue" from a remote host?
Best Regards
vasil |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jan 27, 2010 7:10 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
shifo_de wrote: |
Is it possible to run this pease of code on a separate host (were no qmanager is installed but MQ WebSphere Client only)?
Or with other words: Is it possible to send a reply to "cluster-queue" from a remote host? |
As has been stated many, many times in here there's no link between how an application connects to a queue manager, and how that queue manager distributes messages.
So the discussion above is entirely correct about how messages move round inside a cluster. How you connect to a queue manager to put the reply, and indeed from where you connect, is a separate question.
Hence yes, you can send a reply from a remote host provided it's connected via client to a queue manager which participates in the cluster. Presumably using the same connection by which the code recieved the request it's replying to.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 27, 2010 11:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Just remember that in order to be able to use the combination replytoQueue and replytoQueueManager you NEED to have a default path from the queue manager you are connected to, to the queue manager in the replytoQueueManager... Check the intercommunications and cluster manuals for more details.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|