Author |
Message
|
llaros |
Posted: Tue Dec 22, 2009 7:40 am Post subject: Processing a RFH2 and content inside BLOB |
|
|
Apprentice
Joined: 22 Jan 2008 Posts: 37
|
Hi
My flow receives a message that contains:
MQMD, MQRFH and a payload. I have to take the payload and put it to the output queue without using a parser. The thing is that the payload of the receiving message contains RFH2 and a payload1.
Incoming message structure:
InputRoot.MQMD
InputRoot.MQRFH2
InputRoot.BLOB.BLOB=this blob contains RFH2 and payload1 (let name them InputRoot.BLOB.BLOB.RFH2 and InputRoot.BLOB.BLOB.payload1)
I want to build output msg that will have:
OutputRoot.MQMD=InputRoot.MQMD
OutputRoot.MQRFH2=InputRoot.BLOB.BLOB.RFH2
OutputRoot.BLOB.BLOB=InputRoot.BLOB.BLOB.payload1
My code:
Code: |
SET OutputRoot.MQMD = InputRoot.MQMD;
CREATE LASTCHILD OF OutputRoot DOMAIN('BLOB') NAME 'BLOB';
SET OutputRoot.BLOB.BLOB = InputRoot.BLOB.BLOB;
SET OutputRoot.MQMD.Format = MQFMT_RF_HEADER_2;
|
But the Broker ignores the last line because he does not see the MQRFH2 subtree of the InputRoot. Is there a method to
a) parse some portion of BLOB inside MQRFH2 structure/subtree
b) override the MQMD.Format
c) make some other trick that will tell the broker that the BLOB contains RFH2
Thanks for your help |
|
Back to top |
|
 |
Vitor |
Posted: Tue Dec 22, 2009 7:58 am Post subject: Re: Processing a RFH2 and content inside BLOB |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
llaros wrote: |
I have to take the payload and put it to the output queue without using a parser. |
Why?What's wrong with using a parser?
llaros wrote: |
a) parse some portion of BLOB inside MQRFH2 structure/subtree |
You said you didn't want to parse the message.
llaros wrote: |
b) override the MQMD.Format |
How will that help? Without parsing, you don't know how long the RFH2 is
llaros wrote: |
c) make some other trick that will tell the broker that the BLOB contains RFH2 |
It's called parsing the message. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
llaros |
Posted: Tue Dec 22, 2009 8:55 am Post subject: |
|
|
Apprentice
Joined: 22 Jan 2008 Posts: 37
|
I don't want to use a parser to parse the payload1 not the payload. Thats all.
Code: |
DECLARE structLength BLOB SUBSTRING(InputRoot.BLOB.BLOB from 9 for 4);
DECLARE blobZero BLOB 'X''00000000''';
SET structLength = blobZero||structLength;
DECLARE structLengthINT INT CAST(structLength AS INT);
DECLARE MyMQRFH2 BLOB SUBSTRING(InputRoot.BLOB.BLOB from 1 for structLengthINT);
DECLARE MyBody BLOB SUBSTRING(InputRoot.BLOB.BLOB from structLengthINT+1 for LENGTH(InputRoot.BLOB.BLOB));
|
But still I can't do:
Code: |
SET OutputRoot.MQRFH2 = MyMQRFH2;
|
Is there a way to parse BLOB into MQRFH2? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Dec 22, 2009 9:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
llaros wrote: |
Is there a way to parse BLOB into MQRFH2? |
Only by parsing the message. The method you posted (despite it's various coding issues) fails on the fact the RFH2 is a variable length structure. Without looking, you can't know how long it is.
You could extract the details by coding the position of the length indicators, then casting & substringing. It might work but is it worth the trouble when the parser will do it for you? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Dec 22, 2009 9:11 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You guys may call me crazy but I would have thought that if the RFH headers were correctly chained, they would display correctly in the tree, even if you used the BLOB domain...
So how are the Headers chained in the message?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
imakash |
Posted: Wed Dec 23, 2009 4:58 am Post subject: |
|
|
Newbie
Joined: 22 Dec 2009 Posts: 7
|
try
SET OutputRoot.MQRFH2 = null;
then reparse the output tree. the tree that you will get will have MQMD, MQRFH2 and your payload1 as payload. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 23, 2009 5:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
imakash wrote: |
then reparse the output tree. the tree that you will get will have MQMD, MQRFH2 and your payload1 as payload. |
Implying the tree was initially parsed in the first place, which the poster seems keen to avoid. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Dec 23, 2009 6:23 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You should be able to use CREATE FIELD to turn your BLOB field containing the MQRFH portion into an MQRFH tree. |
|
Back to top |
|
 |
llaros |
Posted: Wed Dec 23, 2009 10:24 am Post subject: |
|
|
Apprentice
Joined: 22 Jan 2008 Posts: 37
|
Thanks to you all.
I've done this yesterday using CREATE statement what Victor had been suggesting ... I forgot to post this here.
Thanks again |
|
Back to top |
|
 |
|