Author |
Message
|
twegmann |
Posted: Mon Mar 31, 2003 12:03 pm Post subject: Counting messages in MQSI |
|
|
 Novice
Joined: 09 Aug 2001 Posts: 23 Location: New Jersey
|
Hoping some one can advise on best way to count messages in a message flow. From one input queue, I need to route messages to one of three output queues (based on a value in the message). Some of the messages go to all three output queues, some go to only a particular output queue.
After all the messages have been drained from the input queue, I want to send one final message to each of the three output queues. This 'final' message is the count of how many messages I placed on each output queue.
So my question is - how can I best setup a counter for each output queue and increment it each time I traverse that 'leg' of the message flow ? |
|
Back to top |
|
 |
kwelch |
Posted: Mon Mar 31, 2003 1:21 pm Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Hi twegmann,
Do you have a way of knowing when you are processing your last message?
How is your Messageflow set up currently? Are you using Propogate?
I guess I have more questions than answers.
Karen |
|
Back to top |
|
 |
twegmann |
Posted: Tue Apr 01, 2003 7:33 am Post subject: |
|
|
 Novice
Joined: 09 Aug 2001 Posts: 23 Location: New Jersey
|
Yes, I can recognize the last message because it is a 'footer' msg that gets sent once all the real data messages have been posted. What I really want to do is to send this 'footer' message to each of the three output queues, but modify it first to contain the specific count of the messages placed on that particular output queue.
So far, design is series of nested filter nodes that are directing the messages to the correct output queues. The first filter checks to see if it the 'footer' msg, if it is not, it passes the msg to nested filters checking the message content to determine the output queue it goes to.
If it is the footer msg, i want to modify it to contain count for first output queue and put a message there (1st q), then modify it to contain the count for the second queue and put a message there (2nd q), and then modify it to contain the count for third queue and put a message there (3rd q). |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Apr 01, 2003 8:56 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You'll need to use a database to store the different counts, as there's no other state that is persistant across messages.
You're better off switching to a RouteToLabel architecture, performance wise, than using more than about two layers of nested Filter nodes. |
|
Back to top |
|
 |
kwelch |
Posted: Tue Apr 01, 2003 12:08 pm Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Hi,
If you have messages coming in that may need to go to 1, 2, or 3 queues based on the content of the message, you might be able to use PROPOGATE and store your counters in the Environment.Variables. You could use DestinationList to assign which queues to go to. I haven't tried this though.
Karen |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Apr 01, 2003 12:36 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The Environment tree is scoped only to the current execution thread of the message flow for the particular input message. Each new message that arrives on the input node gets it's own (empty) copy of Environment.
So if he uses propogate, and stores a counter in Environment, it will only ever get incremented to the total number of messages that get propogated out of one input message, in this case 3. |
|
Back to top |
|
 |
kwelch |
Posted: Tue Apr 01, 2003 12:50 pm Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
oh yeah! Good point! I was forgetting part of the problem. What was I thinking??????? Then I guess storing the 3 counters to some external source is the option. If he used a database wouldn't he have to keep updating the same row every time with the new values of the 3 counters?
Karen |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Apr 01, 2003 2:44 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
He would have to keep doing an update of the same row to increment his counters.
However, he doesn't have to do anything special to access the database. If he wanted to maintain state in some other manner, he would have to create a custom plug-in of some sort or other.
Well. I suppose he could always put out the counters to a queue instead of a database. But then the newest value for the counters is the last message on the queue.
A database is the easiest solution. It may not be the best performance wise, an extremely simple java or c node may run faster. But it's less work to use the db. |
|
Back to top |
|
 |
Lisa |
Posted: Wed Apr 02, 2003 8:30 am Post subject: Support Pac |
|
|
Master
Joined: 07 Jun 2002 Posts: 287 Location: NJ
|
|
Back to top |
|
 |
yaakovd |
Posted: Wed Apr 02, 2003 10:54 am Post subject: |
|
|
Partisan
Joined: 20 Jan 2003 Posts: 319 Location: Israel
|
We use DB2 table in similar case and UpdateDB node.
It is very fast and effective... _________________ Best regards.
Yaakov
SWG, IBM Commerce, Israel |
|
Back to top |
|
 |
nganeshp |
Posted: Wed Sep 29, 2004 6:12 am Post subject: |
|
|
Novice
Joined: 17 Sep 2004 Posts: 18
|
Hi
I was using DxPool in MQSI V2.1 and it was working great. But now i am migrating to WBIMB V5.0 but DxPool is not supported in V5.0. Please advise me whether there is any plug-in nodes or any solution in V5.0 which can replace DxPool.
Thanks
Ganesh _________________ Hi |
|
Back to top |
|
 |
JT |
Posted: Wed Sep 29, 2004 6:24 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
|
Back to top |
|
 |
nganeshp |
Posted: Wed Sep 29, 2004 11:14 am Post subject: |
|
|
Novice
Joined: 17 Sep 2004 Posts: 18
|
Hi,
Thanks for the immediate reply. I am working on it. Thanks for your suggestion.
Ganesh _________________ Hi |
|
Back to top |
|
 |
kirani |
Posted: Wed Sep 29, 2004 5:04 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
If your data is changing very often then I'd recommend using DB, by doing this you are also taking care of fail-over/server crash. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
|