Author |
Message
|
kiran26 |
Posted: Mon Sep 16, 2002 7:15 pm Post subject: How to send 1-> N messages |
|
|
Acolyte
Joined: 06 Feb 2002 Posts: 69
|
Hi
Please suggest me on the following.
1) I want to develope a message flow which sends an input message to multiple Sub-Message flows depending on some condition?? I will be getting destinations from the database.How to code ESQL in the compute node to set DestinationData.
I am trying to work with Route TO Lable, it works fine if i want to send message to single Label node...but i want to send messages to 'N' no. of Labels at the same time.
So i want to know how to code in ESQL for sending messages to 'n' no. of Labels at a time.
Thanks
vishnu |
|
Back to top |
|
 |
lillo |
Posted: Mon Sep 16, 2002 11:08 pm Post subject: |
|
|
Master
Joined: 11 Sep 2001 Posts: 224
|
To generate multiple messages from a single one you can use the propagate statement. Remember to build the whole message before propagate a new one. Also your ESQL code should finish with RETURN FALSE.
Here you have an example. It´s kirani´s code.
Code: |
DECLARE inref REFERENCE to InputRoot.XML.PARENT.CHILD[1];
CREATE FIELD OutputRoot.MRM;
DECLARE outref REFERENCE to OutputRoot.MRM;
WHILE LASTMOVE(inref) THEN
-- Assign properties
-- Assign MQMD
CREATE FIELD OutputRoot.MRM.LEVEL1.LEVEL2;
MOVE outref OutputRoot.MRM.LEVEL1.LEVEL2;
Set outref.field1 = 'a';
Set outref.field2 = 'b';
Set outref.field3 = 'c';
...
PROPAGATE;
MOVE inref TO NEXTSIBLING REPEAT NAME;
END WHILE;
RETURN FALSE; |
I hope this help you.
Cheers, _________________ Lillo
IBM Certified Specialist - WebSphere MQ |
|
Back to top |
|
 |
kiran26 |
Posted: Tue Sep 17, 2002 6:54 am Post subject: |
|
|
Acolyte
Joined: 06 Feb 2002 Posts: 69
|
Hi lillo,
Thanks for your reply.My question was how to send a message to 'n' no. of sub flows using Route TO Label nodes.Can u help me on this.........
bye
sashi |
|
Back to top |
|
 |
warrenpage |
Posted: Tue Sep 17, 2002 10:16 am Post subject: Propogate then route to Label |
|
|
Acolyte
Joined: 19 Feb 2002 Posts: 56 Location: Australia
|
Use Lillo's answer to propagate mulitple copies of the message down your flow, but change the label each time, and then have a route to label to choose which way to go.
so
a) you get 1 message in
b) at your propagate compute node you work out how many paths to take and do 'x' propagates, each time setting a new label
c) right after the propagate you have a route to label to choose the appropriate path
---A---> /--------A
----> PROPAGATE ---B---> ROUTETOLABEL ----\
---B---> ----\-----B
---C---> \--------C |
|
Back to top |
|
 |
kiran26 |
Posted: Tue Sep 17, 2002 10:29 am Post subject: |
|
|
Acolyte
Joined: 06 Feb 2002 Posts: 69
|
Hi,
Can u explain me in more detail with the esql and how to design the message flow. |
|
Back to top |
|
 |
cute_pav |
Posted: Tue Sep 17, 2002 11:51 am Post subject: |
|
|
Acolyte
Joined: 04 Jan 2002 Posts: 65 Location: usa
|
Here are tips to follow:
1)Use compute node for condition(case function) and store in destination list
SET OutputDestinationList.Destination.RouterList.DestinationData[1].labelname = CASE type
WHEN '01' THEN '01'
WHEN '02' THEN '02'
WHEN '03' THEN '03'
WHEN '04' THEN '04'
WHEN '05' THEN '05'
WHEN '06' THEN '06'
WHEN '08' THEN '08'
WHEN '10' THEN '10'
WHEN '99' THEN '99'
END;
ii) make sure local environment and message option in advanced tap of compute node
iii) connect to Routerlable
iiii) use lable node for respective lable upon condition and subflow
YOUR subflow starts from the label node.
lemme know if you still need some in this regard.
pavan |
|
Back to top |
|
 |
kirani |
Posted: Tue Sep 17, 2002 3:21 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
If above postings didn't solve your problem ..
Code: |
DECLARE TCNT INT;
DECLARE CNT INT;
SET CNT = 1;
SET TCNT = CARDINALITY(<some_repeating_field_in_your_input_XML_message>);
WHILE (CNT <= TCNT) DO
SET OutputRoot = InputRoot;
SET OutputLocalEnvironment = InputLocalEnvironment;
-- Use your logic to Generate <labelname> here
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname = <labelname>;
PROPAGATE;
SET CNT = CNT + 1;
END WHILE;
RETURN FALSE;
|
Make sure DestinationList/LocalEnvironment is a part of compute mode.
As you mentioned, for one of the condition you have to propagate your message to all sub-flows. I would recommend you to use propagate to send your message to a particular label node, let's say nomatch, which then send this message to a subflow called subflowall. Your subflowall will have one input terminal and it's out terminal is connected to all subflows, sub1, sub2, ... subn.
I hope this helps. _________________ 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 |
|
 |
|