Author |
Message
|
saddankula |
Posted: Thu Jun 27, 2013 1:01 am Post subject: Differentiate Two message |
|
|
Acolyte
Joined: 27 Jun 2013 Posts: 51
|
how we Differentiate Two message sets like MRM and XML data in computenode Through single mqinput node. |
|
Back to top |
|
 |
Tibor |
Posted: Thu Jun 27, 2013 2:48 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
If I understand the problem properly, you should
- use BLOB parser at MQInput node and then
- re-parse it inside the Compute node based on the pattern, e.g. every XML arrives with an <?xml> prefix. |
|
Back to top |
|
 |
saddankula |
Posted: Thu Jun 27, 2013 2:52 am Post subject: Validate 2 formats of data from single MQ inputnode. |
|
|
Acolyte
Joined: 27 Jun 2013 Posts: 51
|
Hi WMB Developers,
Here I want to validate two formats of input data like XML, MRM through sing MQinput node.
We do not know which format of data will come as input.So I need to check in compute node, Based on input format I will reset the parser of input format with Reset content descriptor.
May I know how in compute node ,decide with format of data as come?
Is that XML or MRM?
I do not know which format of data come to MQinput ,So I take it as a blob format, data which is submit either XML or MRM. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Jun 27, 2013 2:53 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
What Tibor suggested may work; however, this does not overcome the poor design. Generally speaking, a good message system architect will separate the payloads by type into different queues. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Tibor |
Posted: Thu Jun 27, 2013 3:04 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
I can recommend you lancelotlinc's idea as well.
Or you can use something similar (not tested):
Code: |
SET myEncoding = CAST(InputRoot.Properties.Encoding AS INTEGER);
SET myCCSID = CAST(InputRoot.Properties.CodedCharSetId AS INTEGER);
IF CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 1 FOR 5) AS CHARACTER CCSID 437) = '<?xml' THEN
CREATE LASTCHILD OF OutputRoot.XML.MessageData
DOMAIN ('XML')
PARSE (InputRoot.BLOB.BLOB CCSID myCCSID ENCODING myEncoding OPTIONS FolderBitStream ) ;
ELSE
CREATE LASTCHILD OF OutputRoot.XML.MessageData
DOMAIN ('MRM')
PARSE (InputRoot.BLOB.BLOB CCSID myCCSID ENCODING myEncoding OPTIONS FolderBitStream SET 'MsgSetName' TYPE 'MsgType' FORMAT 'TDS1') ;
END IF; |
|
|
Back to top |
|
 |
Esa |
Posted: Thu Jun 27, 2013 3:20 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Even if you get the messages from one queue, they probably come from different sources. They can have different user identity, for example.
If your environment is secure
If the MQI program in one of the sending applications can be changed, they could add something in MQMD.ApplIdentityData (for example)
that you could use for identifying the message source and type.
I would examine the MQMD headers of both messages carefully and try to find something that could be used to identify the message types.
I think that would be a better approach than examining the payload.
And, you don't have to parse the messages programmatically. A simple filter node wired to two ResetContentDescriptor nodes will do.
Last edited by Esa on Thu Jun 27, 2013 3:25 am; edited 1 time in total |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Jun 27, 2013 3:23 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
NealM |
Posted: Thu Jun 27, 2013 1:51 pm Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
Having done it both ways,
(1) BLOB input -->Compute node with two parsers inside
(2) BLOB input -->Filter node with two RCDs hanging off the True/False terminals,
(and you always have to start with the BLOB domain in a case like this),
I would go with #2 as being a bit clearer down the road when maintenance might be required. Always think of the next guy having to pick up what you did. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Jun 27, 2013 9:02 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Tibor wrote: |
e.g. every XML arrives with an <?xml> prefix. |
Not entirely true. That prefix is optional. I see many messages every day that do not have this prefix. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Tibor |
Posted: Fri Jun 28, 2013 1:04 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
smdavies99 wrote: |
Not entirely true. That prefix is optional. I see many messages every day that do not have this prefix. |
That's why I wrote e.g. ...  |
|
Back to top |
|
 |
|