Author |
Message
|
mqbrk_newbie |
Posted: Thu May 13, 2010 9:18 am Post subject: Propagate and destination list |
|
|
 Acolyte
Joined: 13 Sep 2004 Posts: 70
|
Hello All.
Can I use propagate and destination list at the same time ? I currently have message broker version 6.1.
I need to parse a large xml message , hence I used Handling large xml message technique published by storey.
http://www.ibm.com/developerworks/websphere/library/techarticles/0505_storey/0505_storey.html
For example if I have a messge like this..
<outer message>
<innermessage>
<element1></element1>
<element2></element2>
</innermessage>
<innermessage>
<element1></element1>
<element2></element2>
</innermessage>
.
.
.
.
.
<innermessage>
<element1></element1>
<element2></element2>
</innermessage>
</outerMessage>
I was able to propagate inner message chunk as individual message. But I also wanted to route element1 to one queue and element2 to a different queue before the message is propagated to next individual chunk. So I used destination list before propagate. I am not sure whether I did the right thing . Can someone help me how to achieve this scenario,
this is my code snippet
CREATE COMPUTE In_Compute13
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot.MQMD = NULL;
SET OutputRoot.Properties =NULL;
DECLARE nam char;
Declare I Integer 0;
Declare J INTEGER;
-- no of Inner messages
Set J=CARDINALITY(innermessage);
-- Move onto the first Inner Message
DECLARE InputMessage REFERENCE TO innermesage;
-- Check if we are at the root or at the end of the outer message
While (I<J)
DO
IF I>=1 THEN DELETE PREVIOUSSIBLING OF InputMessage;
END IF;
-- Increment the Inner Message counter
SET I = I + 1;
SET firstElement = innermessage.element1;
SET OutputLocalEnvironment.Destination.MQ.Defaults.queueName='queue1';
SET OutputRoot.Properties.MessageSet= 'DTN8B3O002001';
SET OutputRoot.Properties.MessageType= 'msg_element1';
SET OutputRoot.Properties.MessageFormat= 'CWF1';
SET OutputRoot.MRM = Environment.outmsg;
SET SecondElement = innermessage.element2;
SET OutputRoot.Properties.MessageSet= 'DTN8B3O002001';
SET OutputRoot.Properties.MessageType= 'msg_element2';
SET OutputRoot.Properties.MessageFormat= 'CWF1';
SET OutputRoot.MRM = Environment.outmsg;
SET OutputLocalEnvironment.Destination.MQ.Defaults.queueName='queue2';
PROPAGATE;
MOVE InputMessage NEXTSIBLING;
END WHILE;
RETURN FALSE ;
END;
END MODULE;
Appreciate your help in advance. |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 13, 2010 9:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Don't you need to PROPOGATE element1 so it can reach queue1 before overwriting it with element2? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqbrk_newbie |
Posted: Thu May 13, 2010 9:44 am Post subject: Propagate and destination list |
|
|
 Acolyte
Joined: 13 Sep 2004 Posts: 70
|
No. My goal is to route element1 and element2 to different queues before it goes to next chunk of inner message. |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 13, 2010 10:03 am Post subject: Re: Propagate and destination list |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqbrk_newbie wrote: |
My goal is to route element1 and element2 to different queues before it goes to next chunk of inner message. |
I understood that from your post. My question stands. You're populating the output with element1 then, without propogating, you're overwriting it with element2. So how does element1 get anywhere (use of a distribution list notwithstanding)? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqbrk_newbie |
Posted: Thu May 13, 2010 10:31 am Post subject: Propagate and destination list |
|
|
 Acolyte
Joined: 13 Sep 2004 Posts: 70
|
Hi Vitor,
Yea I understand. I was wondering the same thing. Its quite not posssible . Is there any way that I could achieve what I need ?
I have to handle large messages at the same time I need to parse the inner structure and route to different queues.
I couldnt think of any other way of doing this.
Thanks really for your quick response. |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 13, 2010 11:15 am Post subject: Re: Propagate and destination list |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqbrk_newbie wrote: |
Yea I understand. I was wondering the same thing. Its quite not posssible . Is there any way that I could achieve what I need ? |
Well I've been pushing for a propogate between the 2 settings in my previous posts; why don't you feel that's a good idea given your set up (I could be missing something in your requirement here).
mqbrk_newbie wrote: |
I couldnt think of any other way of doing this.
|
No, it seems reasonable. You might want to avoid the use of CARDINALITY and counters; nothing to do with the problem described here but it's a very inefficient way of dealing with a large tree. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Sam Uppu |
Posted: Thu May 13, 2010 1:21 pm Post subject: Re: Propagate and destination list |
|
|
 Yatiri
Joined: 11 Nov 2008 Posts: 610
|
mqbrk_newbie wrote: |
Hello All.
Can I use propagate and destination list at the same time ? I currently have message broker version 6.1.
I need to parse a large xml message , hence I used Handling large xml message technique published by storey.
http://www.ibm.com/developerworks/websphere/library/techarticles/0505_storey/0505_storey.html
For example if I have a messge like this..
<outer message>
<innermessage>
<element1></element1>
<element2></element2>
</innermessage>
<innermessage>
<element1></element1>
<element2></element2>
</innermessage>
.
.
.
.
.
<innermessage>
<element1></element1>
<element2></element2>
</innermessage>
</outerMessage>
I was able to propagate inner message chunk as individual message. But I also wanted to route element1 to one queue and element2 to a different queue before the message is propagated to next individual chunk. So I used destination list before propagate. I am not sure whether I did the right thing . Can someone help me how to achieve this scenario,
this is my code snippet
CREATE COMPUTE In_Compute13
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot.MQMD = NULL;
SET OutputRoot.Properties =NULL;
DECLARE nam char;
Declare I Integer 0;
Declare J INTEGER;
-- no of Inner messages
Set J=CARDINALITY(innermessage);
-- Move onto the first Inner Message
DECLARE InputMessage REFERENCE TO innermesage;
-- Check if we are at the root or at the end of the outer message
While (I<J)
DO
IF I>=1 THEN DELETE PREVIOUSSIBLING OF InputMessage;
END IF;
-- Increment the Inner Message counter
SET I = I + 1;
SET firstElement = innermessage.element1;
SET OutputLocalEnvironment.Destination.MQ.Defaults.queueName='queue1';
SET OutputRoot.Properties.MessageSet= 'DTN8B3O002001';
SET OutputRoot.Properties.MessageType= 'msg_element1';
SET OutputRoot.Properties.MessageFormat= 'CWF1';
SET OutputRoot.MRM = Environment.outmsg;
SET SecondElement = innermessage.element2;
SET OutputRoot.Properties.MessageSet= 'DTN8B3O002001';
SET OutputRoot.Properties.MessageType= 'msg_element2';
SET OutputRoot.Properties.MessageFormat= 'CWF1';
SET OutputRoot.MRM = Environment.outmsg;
SET OutputLocalEnvironment.Destination.MQ.Defaults.queueName='queue2';
PROPAGATE;
MOVE InputMessage NEXTSIBLING;
END WHILE;
RETURN FALSE ;
END;
END MODULE;
Appreciate your help in advance. |
I think you can propagate element 1 via out terminal 1 to queue 1 and element 2 via out terminal 2 to queue 2 . |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 13, 2010 1:42 pm Post subject: Re: Propagate and destination list |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Sam Uppu wrote: |
I think you can propagate element 1 via out terminal 1 to queue 1 and element 2 via out terminal 2 to queue 2 . |
It's a valid alternative, but does assume the existence of 2 output nodes with queue names coded or overridden; the OP seems to want to avoid that.
It still requires 2 propogate statements as I've been saying. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqbrk_newbie |
Posted: Thu May 13, 2010 11:51 pm Post subject: Propagate and destination list |
|
|
 Acolyte
Joined: 13 Sep 2004 Posts: 70
|
Thanks a lot for your input Vitor I used mulitple propagate to Terminals to achieve what I needed . |
|
Back to top |
|
 |
|