Author |
Message
|
kordi |
Posted: Fri Apr 17, 2015 12:36 pm Post subject: Dynamic reply mechanism |
|
|
Centurion
Joined: 28 May 2012 Posts: 146 Location: PL
|
Hi guys,
I am wondering how actually dynamic replies looks like. It is pretty clear for me how to use remote queues to send message to remote local queue but I don't exactly know how it is done without qremote.
Here is piece of code. Can you please help me with missing elements?
Code: |
System.out.println("Connecting to queue manager: " + qManager);
MQQueueManager qMgr = new MQQueueManager(qManager);
// Set up the options on the queue we wish to open
int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT;
// Now specify the queue that we wish to open and the open options
System.out.println("Accessing queue: " + qGetName);
MQQueue queue = qMgr.accessQueue(qGetName, openOptions);
// Now get the message off the queuen. First define a WebSphere MQ message to receive the data
MQMessage rcvMessage = new MQMessage();
// Specify default get message options
MQGetMessageOptions gmo = new MQGetMessageOptions();
// Get the message off the queue.
System.out.println("Getting the message from queue...");
queue.get(rcvMessage, gmo);
String ReplyToQ = rcvMessage.replyToQueueName;
String ReplyToQmgr = rcvMessage.replyToQueueManagerName;
// and now I want to process message and send this message back to ReplyToQ and ReplyToQueueManager destination with no use of remote queue
// What queue to open? What headers to set?
|
Thanks in advance! |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Apr 18, 2015 11:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
The signature of accessQueue you used is not the only signature. Explore further...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
RogerLacroix |
Posted: Mon Apr 20, 2015 12:23 pm Post subject: Re: Dynamic reply mechanism |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
kordi wrote: |
Code: |
// Set up the options on the queue we wish to open
int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT; |
|
If you are only reading from that queue then you should NOT open for both input and output (and add fail if quescing).
i.e.
Code: |
int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_FAIL_IF_QUIESCING |
kordi wrote: |
I am wondering how actually dynamic replies looks like. It is pretty clear for me how to use remote queues to send message to remote local queue but I don't exactly know how it is done without qremote. |
There is nothing special about a (temporary) dynamic queue. How would you open a local queue?
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
kordi |
Posted: Mon Apr 20, 2015 2:05 pm Post subject: Re: Dynamic reply mechanism |
|
|
Centurion
Joined: 28 May 2012 Posts: 146 Location: PL
|
RogerLacroix Thank you for the tips. I am struggling to figure out how to use so called "dynamic replies" which are familiar with COA or COD.
When we use COA or COD we need to define xmitq with the same name as q manager to which those reports should arrive (and respective channel of course).
What I dont know is how should reply to request looks like, when no qremote exist, only xmitq named as remote q manager and channel using this xmitq.
Please take a look at my piece of code.
What I tried was to put reply to xmitq directly (message went to DLQ) and I also put message to SYSTEM.DEFAULT.MODEL.QUEUE and this message was gone.
How I should reply to request, using no qremote, to deliver this message to ReplyToQ and ReplyToQmgr? I much appreciate code sample because I know how it works "in theory".
Many thanks. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Apr 21, 2015 4:59 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
First READ this http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q033830_.htm
Then think about what you are going to put into each of the fields for following method call:
Code: |
MQQueue replyqueue= MQQueueManager.AccessQueue(Name$, OpenOptions&, QueueManagerName$, DynamicQueueName$, AlternateUserId$); |
like
Code: |
replyqueue= MQQueueManager.AccessQueue(replytoqname, MQOO_options, replytoqmgrname, null, null); |
Also have a look at the different parameters on the qmgr.put method... ( )
And just for clarification MQQueueManager is the queue manager you are connected to and not a static reference to the class.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kordi |
Posted: Wed Apr 22, 2015 1:05 pm Post subject: |
|
|
Centurion
Joined: 28 May 2012 Posts: 146 Location: PL
|
fjb_saper Thank you, this is it. This is what I was looking for, my piece of code is now working as expected.
The problem was that I assumed there are no more parameters in AccessQueue method. Thanks again! |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Apr 23, 2015 4:59 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
kordi wrote: |
fjb_saper Thank you, this is it. This is what I was looking for, my piece of code is now working as expected.
The problem was that I assumed there are no more parameters in AccessQueue method. Thanks again! |
Well, If you had read my first post you would have had the answer 5 days ago!  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kordi |
Posted: Thu Apr 23, 2015 9:49 am Post subject: |
|
|
Centurion
Joined: 28 May 2012 Posts: 146 Location: PL
|
Yeah but I wasn't really sure what did you mean by "signature"  |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Apr 23, 2015 11:48 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
|
Back to top |
|
 |
kordi |
Posted: Thu Apr 23, 2015 12:30 pm Post subject: |
|
|
Centurion
Joined: 28 May 2012 Posts: 146 Location: PL
|
I have read and remembered. Bacame a bit smarter now
Thank you. |
|
Back to top |
|
 |
|