Author |
Message
|
goffinf |
Posted: Mon May 21, 2012 4:17 am Post subject: Reading from a dynamic temp queue with an MQGet node |
|
|
Chevalier
Joined: 05 Nov 2005 Posts: 401
|
version: 6.1.0.10
I have a flow which creates a PCF message to Inhibit/Allow gets and puts to a given queue. That all works fine ... well sort of.
It works fine if I have a ReplyTo queue already set up.
What I would like to do is use a temporary dynamic queue for the ReplyTo location and, using an MQGet node, read the PCF response message from there. Like this :-
Input --> Compute (createPCF) --> MQOutput (SYSTEM.ADMIN.COMMAND.QUEUE) --> Compute (setQName) --> MQGet --> Output
But what to use as the ReplyTo queue name for the MQOutput node and what to use as the queue name for the MQGet ?
I tried using SYSTEM.DEFAULT.MODEL.QUEUE for the MQOutput MQMD.ReplyTo, .. no error there shown in user trace, so that could be OK ...
But if I use SYSTEM.DEFAULT.MODEL.QUEUE for the MQGet, it (not unexpectedly) returns a 2033 and exits via the 'No Message' terminal.
Is there a way of discovering the name of the dynamic queue so I can provide it to the MQGet ?
I have seen some Java code that MAY be able to do that that I could put into a JCN (see below), but is there a way without resorting to Java ?
Code: |
String inputQName = "SYSTEM.DEFAULT.MODEL.QUEUE";
String dynamicQName = "ABC.*";
String replyToQName = null;
int openInputOptions = MQC.MQOO_INQUIRE + .......
MQQueueManager _qMgr = new MQQueueManager("myQM");
MQQueue _inQ = _qMgr.accessQueue(inputQName, openInputOptions, null, dynamicQName, null);
replyToQName = _inQ.name; // SAVE THIS
|
|
|
Back to top |
|
 |
Esa |
Posted: Mon May 21, 2012 4:34 am Post subject: Re: Reading from a dynamic temp queue with an MQGet node |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
goffinf wrote: |
Is there a way of discovering the name of the dynamic queue so I can provide it to the MQGet ?
|
You should be able to see it it LocalEnvironment.WrittenDestination after the MQOutput node. |
|
Back to top |
|
 |
goffinf |
Posted: Mon May 21, 2012 5:19 am Post subject: Re: Reading from a dynamic temp queue with an MQGet node |
|
|
Chevalier
Joined: 05 Nov 2005 Posts: 401
|
Esa wrote: |
You should be able to see it it LocalEnvironment.WrittenDestination after the MQOutput node. |
But the queue name there will be the name of the queue that the PCF message is written to (SYSTEM.ADMIN.COMMAND.QUEUE) and not the name of the queue that the REPLY will be sent to, right ?
Fraser. |
|
Back to top |
|
 |
cociu_2012 |
Posted: Mon May 21, 2012 5:47 am Post subject: Re: Reading from a dynamic temp queue with an MQGet node |
|
|
Acolyte
Joined: 06 Jan 2012 Posts: 72
|
goffinf wrote: |
But the queue name there will be the name of the queue that the PCF message is written to (SYSTEM.ADMIN.COMMAND.QUEUE) and not the name of the queue that the REPLY will be sent to, right ?
Fraser. |
Yes, it's the name of the queue that you're sending PCF message.
What are you trying to achieve?
1) send a message to a Queue (with a replyToQ propertie configured),
1.1)Some aplication consumes it
1.2)Send a response message to the replyToQ specified at fisrt step.
2) Consume replied message in you initial flow, using MQGet node.
So what is your problem. You have all you need for this clasic Request/Reply mechanism. You have the name of the Queue that the messege will be delivered. Just configure how you want to read it (by corelationID, by message Id etc). Be sure that the middle aplication is sending the message in reply Queue. |
|
Back to top |
|
 |
Esa |
Posted: Mon May 21, 2012 5:53 am Post subject: Re: Reading from a dynamic temp queue with an MQGet node |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
goffinf wrote: |
But the queue name there will be the name of the queue that the PCF message is written to (SYSTEM.ADMIN.COMMAND.QUEUE) and not the name of the queue that the REPLY will be sent to, right ?
Fraser. |
Yes, correct.
Why do you want to use a dynamic reply-to queue? |
|
Back to top |
|
 |
cociu_2012 |
Posted: Mon May 21, 2012 5:59 am Post subject: Re: Reading from a dynamic temp queue with an MQGet node |
|
|
Acolyte
Joined: 06 Jan 2012 Posts: 72
|
A code snippet:
Code: |
SET OutputRoot.MQMD.CorrelId=Environment.Variables.CorrelID ;
SET OutputRoot.MQMD.MsgId=Environment.Variables.CorrelID ;
set OutputRoot.MQMD.Format = 'MQHRF2 ';
set OutputRoot.MQRFH2.mcd.Msd = Environment.Variables.Domain;
set OutputRoot.MQRFH2.mcd.Set = Environment.Variables.Set;
set OutputRoot.MQRFH2.mcd.Type = Environment.Variables.Type;
set OutputRoot.MQRFH2.mcd.Fmt = Environment.Variables.Format;
SET OutputLocalEnvironment.MQ.GET.QueueName=Environment.Variables.QueueReq;
SET OutputLocalEnvironment.MQ.GET.MQGMO.WaitInterval=Environment.Variables.ReqTimeout;
|
On the MQGet nod, set getByMessageId check box.
You should have all other information that is set in ESQL Compute node, before the MQGet. |
|
Back to top |
|
 |
Esa |
Posted: Mon May 21, 2012 6:13 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Are you sure the generated reply-to queue name is not copied to LocalEnvironment.WrittenDestination? I think it should contain the whole MQMD of the sent message? |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon May 21, 2012 6:13 am Post subject: Re: Reading from a dynamic temp queue with an MQGet node |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Esa wrote: |
Why do you want to use a dynamic reply-to queue? |
To avoid having to define a specific Reply-to-queue.
Using dynamic queues (like many other aspects of MQ 'bit twiddling' programming) is a dying art these days. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Esa |
Posted: Mon May 21, 2012 6:15 am Post subject: Re: Reading from a dynamic temp queue with an MQGet node |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
smdavies99 wrote: |
To avoid having to define a specific Reply-to-queue.
Using dynamic queues (like many other aspects of MQ 'bit twiddling' programming) is a dying art these days. |
Well I thought he was trying to support multiple instances of the flow. |
|
Back to top |
|
 |
cociu_2012 |
Posted: Mon May 21, 2012 6:28 am Post subject: |
|
|
Acolyte
Joined: 06 Jan 2012 Posts: 72
|
Esa wrote: |
Are you sure the generated reply-to queue name is not copied to LocalEnvironment.WrittenDestination? I think it should contain the whole MQMD of the sent message? |
Ok, so step by step explanation is needed :
Note: these configurations are for dynamic Req/Rsp queue
1) Set the name of the Q where the PCF message needs to go
Code: |
SET OutputLocalEnvironment.Destination.MQ.DestinationData.queueName='ReqQueue';
SET OutputRoot.MQMD.ReplyToQ='reply2Q';
|
2) Send the message to MQOutput. Make sure the nod is configured to accept Dinamic Q name.
3) Read the message from Reply to Q:
Code: |
SET OutputRoot.MQMD.MsgId=Environment.Variables.CorrelID ;
SET OutputLocalEnvironment.MQ.GET.QueueName=Environment.Variables.QueueRsp;
SET OutputLocalEnvironment.MQ.GET.MQGMO.WaitInterval =Environment.Variables.RspTimeout; |
Note: other properties can be required
4) Configure the MQGet to read by messageId. |
|
Back to top |
|
 |
goffinf |
Posted: Mon May 21, 2012 6:34 am Post subject: Re: Reading from a dynamic temp queue with an MQGet node |
|
|
Chevalier
Joined: 05 Nov 2005 Posts: 401
|
smdavies99 wrote: |
Esa wrote: |
Why do you want to use a dynamic reply-to queue? |
To avoid having to define a specific Reply-to-queue.
Using dynamic queues (like many other aspects of MQ 'bit twiddling' programming) is a dying art these days. |
Exactly so. |
|
Back to top |
|
 |
goffinf |
Posted: Mon May 21, 2012 6:37 am Post subject: |
|
|
Chevalier
Joined: 05 Nov 2005 Posts: 401
|
cociu_2012 wrote: |
Esa wrote: |
Are you sure the generated reply-to queue name is not copied to LocalEnvironment.WrittenDestination? I think it should contain the whole MQMD of the sent message? |
Ok, so step by step explanation is needed :
Note: these configurations are for dynamic Req/Rsp queue
1) Set the name of the Q where the PCF message needs to go
Code: |
SET OutputLocalEnvironment.Destination.MQ.DestinationData.queueName='ReqQueue';
SET OutputRoot.MQMD.ReplyToQ='reply2Q';
|
2) Send the message to MQOutput. Make sure the nod is configured to accept Dinamic Q name.
3) Read the message from Reply to Q:
Code: |
SET OutputRoot.MQMD.MsgId=Environment.Variables.CorrelID ;
SET OutputLocalEnvironment.MQ.GET.QueueName=Environment.Variables.QueueRsp;
SET OutputLocalEnvironment.MQ.GET.MQGMO.WaitInterval =Environment.Variables.RspTimeout; |
Note: other properties can be required
4) Configure the MQGet to read by messageId. |
Maybe I'm missing something here but, given I want to use a temporary dynamic queue for the response from the PCF request, where exactly am I going to get the QName to set into the dynamic location for the MQGet ?? Your code above implies I know this before hand, but I don't ... because the queue is created dynamically based on the SYSTEM.DEFAULT.MODEL.QUEUE
Fraser. |
|
Back to top |
|
 |
goffinf |
Posted: Mon May 21, 2012 6:41 am Post subject: |
|
|
Chevalier
Joined: 05 Nov 2005 Posts: 401
|
Esa wrote: |
Are you sure the generated reply-to queue name is not copied to LocalEnvironment.WrittenDestination? I think it should contain the whole MQMD of the sent message? |
This is what is there after the MQOutput of the PCF message to SYSTEM.ADMIN.COMMAND.QUEUE :-
Code: |
WrittenDestination
MQ
DestinationData
queueName:CHARACTER:SYSTEM.ADMIN.COMMAND.QUEUE
queueManagerName:CHARACTER:
replyIdentifier:BLOB:[B@72ce72ce
msgId:BLOB:[B@736e736e
correlId:BLOB:[B@741a741a
GroupId:BLOB:[B@74ba74ba
|
|
|
Back to top |
|
 |
Esa |
Posted: Mon May 21, 2012 7:03 am Post subject: Re: Reading from a dynamic temp queue with an MQGet node |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
goffinf wrote: |
But if I use SYSTEM.DEFAULT.MODEL.QUEUE for the MQGet, it (not unexpectedly) returns a 2033 and exits via the 'No Message' terminal.
|
If you wire a passtrough node from 'No Message' terminal, can you see anything in LocalEnvironment. RC 2033 indicates that a dynamic queue was created.
Create your own model queue and make it permanent. You should be able to see if the queue was created and if you are lucky, you can see the name in LocalEnvironment. If it works, you can have one MQGet before the MQOutput for creating the dynamic queue and another for reading the reply.
I'm sorry I am not able to test it myself. I think I have a tendonitis (I am not sure if this is the correct term) in my right shoulder, caused by the computer mouse, and working is painfull and slow. Trying to became temporarily left-handed, but it's even slower. And affecting my thinking... |
|
Back to top |
|
 |
goffinf |
Posted: Mon May 21, 2012 9:08 am Post subject: Re: Reading from a dynamic temp queue with an MQGet node |
|
|
Chevalier
Joined: 05 Nov 2005 Posts: 401
|
Esa wrote: |
If you wire a passtrough node from 'No Message' terminal, can you see anything in LocalEnvironment. RC 2033 indicates that a dynamic queue was created.
|
Nothing that refer to the ReplyTo queue no.
Esa wrote: |
Create your own model queue and make it permanent. You should be able to see if the queue was created
|
Ok, did this, and I could see a queue *was* created :-
AMQ.4FBA18A00B680020
Esa wrote: |
and if you are lucky, you can see the name in LocalEnvironment.
|
No luck, that queue name doesn't appear in the LE
Esa wrote: |
If it works, you can have one MQGet before the MQOutput for creating the dynamic queue and another for reading the reply.
|
Prresumably for the first MQGet I'd just wire ther No Message terminal ?.
Unfortunately though the dynamic queue name is nowhere to be found (pity - nice idea)
Esa wrote: |
I'm sorry I am not able to test it myself. I think I have a tendonitis (I am not sure if this is the correct term) in my right shoulder, caused by the computer mouse, and working is painfull and slow. Trying to became temporarily left-handed, but it's even slower. And affecting my thinking... |
Sorry to hear that, I know what that can feel like after some years of rowing.
Normally the pain that I get the most is somewhere lower down, and the causes are generally managerial
Regards
Fraser. |
|
Back to top |
|
 |
|