Author |
Message
|
brokendrum |
Posted: Fri Mar 07, 2003 3:28 am Post subject: Can I route messages to more than one label? |
|
|
Apprentice
Joined: 14 Jan 2003 Posts: 34
|
I need to route a message to multiple labels, i.e. create multiple instances of the message and send them to different labels. I've tried the following code but without much luck;
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname[1] = 'Label1';
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname[2] = 'Label2';
Any ideas? |
|
Back to top |
|
 |
lillo |
Posted: Fri Mar 07, 2003 5:14 am Post subject: |
|
|
Master
Joined: 11 Sep 2001 Posts: 224
|
Have you try the propagate statement? PROPAGATE is new in WMQI 2.1. _________________ Lillo
IBM Certified Specialist - WebSphere MQ |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Mar 07, 2003 6:21 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I think you need to say
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname = 'Label1';
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[2].labelname = 'Label2';
instead of
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname[1] = 'Label1';
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname[2] = 'Label2';
That is, you need to create a list of DestinationData fields, each one having one single lablename field. |
|
Back to top |
|
 |
brokendrum |
Posted: Fri Mar 07, 2003 9:02 am Post subject: |
|
|
Apprentice
Joined: 14 Jan 2003 Posts: 34
|
lillo - The PROPAGATE function has the required effect, Thanks.
Jeff - I don't think this will work because the route to label node has the option to route either to the first or last destination in the list. Correct me if I'm wrong though. I did try something like this before I posted the question but with no luck. Thanks for your input anyway. |
|
Back to top |
|
 |
kirani |
Posted: Fri Mar 07, 2003 9:18 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
In addition to what Jeff said, you also need to have multiple RouteToLabel nodes in your message flow for it to work. _________________ 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 |
|
 |
Yanghui |
Posted: Mon May 26, 2003 2:49 am Post subject: |
|
|
Disciple
Joined: 08 May 2002 Posts: 151 Location: Dublin, Ireland
|
Does this mean it's only able to route a message to two labels, one for "Route To First" and another for "Route To Last"?
Thanks
-Yanghui |
|
Back to top |
|
 |
kirani |
Posted: Mon May 26, 2003 11:03 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
With each RouteToLabel node, depending on a field value, you can route your message to N label nodes. So if you want to route based on 2 fields, then you will need 2 RouteToLabel nodes.
I think in the given scenario you are trying to route based on single field, so your ESQL code should be ...
Code: |
If (condition1) THEN
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname = 'Label1';
ELSEIF (condition2) THEN
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname = 'Label2';
ELSEIF (condition3) THEN
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelname = 'Label3';
END IF;
|
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 |
|
 |
Yanghui |
Posted: Wed May 28, 2003 1:45 am Post subject: |
|
|
Disciple
Joined: 08 May 2002 Posts: 151 Location: Dublin, Ireland
|
Hi, Kirani,
Thanks for your reply.
I notice that you used ELSEIF in your ESQL. I remember I always got syntax error if I did so (NT+CSD2). What works for me is only something like:
IF... THEN
....
ELSE
IF ... THEN
...
ELSE
IF ... THEN
...
ELSE
END IF;
END IF;
END IF;
It would be much nicer if we can use something like:
IF ... THEN
...
ELSEIF ... THEN
...
ELSEIF ... THEN
...
END IF;
Do you really make the late one work? How? Thanks.
Regards
-Yanghui |
|
Back to top |
|
 |
EddieA |
Posted: Thu May 29, 2003 9:10 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
When you have multiple labels in the LocalEnvironment, the Route to Label node sends it to either the first, or the last depending on the Properties. It then REMOVES that one from the list so that the next Route to Label will send it to the next one specified (again based on first or last).
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
Yanghui |
Posted: Fri May 30, 2003 12:43 am Post subject: |
|
|
Disciple
Joined: 08 May 2002 Posts: 151 Location: Dublin, Ireland
|
Eddie,
Thanks for your response.
I never know the labels can work like this way. I am wondering in which circumstance the feature can be exploied. Frankly, most time when you want to route msg to different label, logically you already know which label should be routed to. Why is it still bothered to choose the first or the last ones? Do you have any experience of using this feature? Many thanks in advance.
Regards
-Yanghui |
|
Back to top |
|
 |
|