Author |
Message
|
nmaddisetti |
Posted: Thu Mar 19, 2009 5:46 am Post subject: reading more than one message using MQGET |
|
|
Centurion
Joined: 06 Oct 2004 Posts: 145
|
Hi,
Our requirement is to read the multiple messages having same correlation id from the queue.
This is required because we have three flows in sequense.
flow1-->will trigger-->flow2-->will trigger-->flow3
in flow2 and flow3 we are reading messages using MQGET with matching message id( these message ids are available in DB and are inserted by flow1)
in certain scenarios flow1 may fail (message ids wont be available in DB)and we dont reach flow2 and flow3 then we want to delete the messages from these queues.
Client application who is putting messages on MQGET queues dont have capability to set expiration time.
I tried with MQGET but it is reading only one message from the queue.
Do I need to some configuration in MQGET to read all messages in the queue with same correlation id.
will MQGET support for reading multiple messages with same correlation id?
can you please through your thoughts to achive this functionality.
Thanks & Regards,
Venkat. |
|
Back to top |
|
 |
pcelari |
Posted: Thu Mar 19, 2009 6:18 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
You can certainly wire more than one MQGet nodes to the same out terminal of your MQInput node where your reply comes in, but connect only one of them to the down stream flow.
like this:
MQInput4Replies -> MQGet_1 -> downstream input terminal
-> MQGet_2
-> MQGet_3
This way, the two MQGet with no out terminal connected will result in the extra msg with matching CorrelId deleted.
Hope this helps.
 _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
HOMETOWN47 |
Posted: Thu Mar 19, 2009 9:07 am Post subject: |
|
|
Apprentice
Joined: 25 Mar 2003 Posts: 34
|
You could always have the Out terminal of the MQGet node wired back to it's own In terminal. If you want to do processing on any messages you get from the node then also wire the out terminal to further nodes for processing. If you are just discarding the messages then wire the No message terminal to continue further processing once all the messages with the same Id have been retrieved. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Mar 19, 2009 9:21 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
HOMETOWN47 wrote: |
You could always have the Out terminal of the MQGet node wired back to it's own In terminal |
And then watch the Broker consume CPU and memory until the machine halts and catches fire. |
|
Back to top |
|
 |
nmaddisetti |
Posted: Thu Mar 19, 2009 10:18 am Post subject: |
|
|
Centurion
Joined: 06 Oct 2004 Posts: 145
|
Hi mqjeff,
You are right if we keep our flow in loop then broker will go down we have seen this one in one of our earlier project.
Can some one throw some light on MQGET to achieve the functionality mentioned above.
Thanks & Regards,
Venkat. |
|
Back to top |
|
 |
mgk |
Posted: Thu Mar 19, 2009 10:25 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
Can some one throw some light on MQGET to achieve the functionality mentioned above |
Use the PROPAGATE statement from a compute node to "call-return" to the MQGet node _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
nmaddisetti |
Posted: Thu Mar 19, 2009 12:24 pm Post subject: |
|
|
Centurion
Joined: 06 Oct 2004 Posts: 145
|
Hi mgk,
I got the solution with your statement.
Thanks a lot.
Venkat. |
|
Back to top |
|
 |
HOMETOWN47 |
Posted: Fri Mar 20, 2009 3:22 am Post subject: |
|
|
Apprentice
Joined: 25 Mar 2003 Posts: 34
|
Not too sure why you think that you'll get an infinite loop if you wire the Out terminal to the In terminal of the MQGet node.
My understanding is that you'll only get something on the Out terminal if the Get retrieved a message. Assuming that the number of messages on the queue is going to be low (as previous posts said that you're only expecting messages left because of exceptions) the Get is not going to consume CPU. If the Get is done by correlation Id then the 'no match' scenario will stop the loop back to the In terminal and processing will continue if the 'no message' terminal is wired to other nodes.
I stand to be correct but PLEASE provide explanantions why it's going to cause memory/CPU usage issues. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Mar 20, 2009 3:31 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
HOMETOWN47 wrote: |
I stand to be correct but PLEASE provide explanantions why it's going to cause memory/CPU usage issues. |
Each instance of an MQGet node is its own thread and will sleep while the get waits to time out, causing paging and all sorts of bad things.
Especially if you have multiple instances of this flow all doing that. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
HOMETOWN47 |
Posted: Fri Mar 20, 2009 4:02 am Post subject: |
|
|
Apprentice
Joined: 25 Mar 2003 Posts: 34
|
Thanks for the information but still not sure why this is an issue.
Are you saying the issue with paging will be when there are multiple messages to get off the queue and each time the MQ Get is called (via the loop back) will mean a new instance of the node and hence a new thread ?
How is this different from using propagate to the MQGet node as suggested in earlier posts ?
Would appreciate further explanation on your answer as it's an interesting subject ! |
|
Back to top |
|
 |
Vitor |
Posted: Fri Mar 20, 2009 4:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
HOMETOWN47 wrote: |
Would appreciate further explanation on your answer as it's an interesting subject ! |
I can put it no more eloquently than the discussion here.
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
HOMETOWN47 |
Posted: Fri Mar 20, 2009 4:31 am Post subject: |
|
|
Apprentice
Joined: 25 Mar 2003 Posts: 34
|
Vitor, thanks for the link to the other post and I can see that if you were looping through 1000's of messages then memory issues are going to be a problem but having read the original posters email he's saying that he's only going to have 2 or 3 messages with the same correlation id on the queue.
I think that the loopback would work and not cause memory issues but also agree in hindsight that the PROPAGATE is the better solution and is more future proof i.e what if the number of messages on the queue increases, will this then cause memory issues.
An interesting topic. |
|
Back to top |
|
 |
|