|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
TDS --> XML Conversion Problem |
« View previous topic :: View next topic » |
Author |
Message
|
alastor52 |
Posted: Tue May 09, 2006 12:04 pm Post subject: TDS --> XML Conversion Problem |
|
|
Apprentice
Joined: 09 May 2006 Posts: 37
|
I'm running MQ v6.0 and the Message Broker Toolkit on Win XP. I'm having a problem converting legacy formatted (tagged and delimited) messages to XML. Each message that comes in can have varying combinations of data elements and even some repeating elements. There are about 50 different message types and each is designated by a 1-5 character 'message key'. An example message would be:
Q.1:LAST/FIRST/MIDDLE/.7:19700707.
I am able to define a message type for a specific legacy message and get it to convert to XML sucessfully. What I would like to do is define message types for all the different legacy messages.
My question is, how do I match up the 'message key' of the legacy message with a defined message in the broker? I've tried Interpret Value As: MessageIdentity, creating a group, and a few other things.
If someone could help me out or suggest a better way to do this I would aprreciate it. Thanks. |
|
Back to top |
|
 |
sirsi |
Posted: Tue May 09, 2006 12:23 pm Post subject: |
|
|
Disciple
Joined: 11 Mar 2005 Posts: 177
|
As you said define different messages for TDS.
handle the input file as blob and determine '1-5 character message key'... use RCD to convert your message to corresponding TDS format.
while creating output message you can set the Message Type property to corresponding TDS message. |
|
Back to top |
|
 |
kimbert |
Posted: Wed May 10, 2006 12:55 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
how do I match up the 'message key' of the legacy message with a defined message in the broker? |
Sirsi's solution will work, but there is a neater solution, as your post suggests.
Your logical model should look something like this ( I'm assuming that the 'Q.1' is the message key in your example )
Code: |
EnvelopeMessage
MessageKey [type=xsd:string InterpretValueAs='Message Identity']
MessageGroup [Composition=Message]
Message 1 [ Message Alias='Q.1']
someElements
...
Message 2 [ Message Alias='Q.2']
someElements
... |
Obviously, you'll have to set some other TDS properties to ensure that the MessageKey gets parsed correctly, but it sounds as if you've already solved that part of the problem. Let me know how it goes. |
|
Back to top |
|
 |
alastor52 |
Posted: Wed May 10, 2006 10:23 am Post subject: |
|
|
Apprentice
Joined: 09 May 2006 Posts: 37
|
First off, thanks for the speedy responses. I'm pretty much a noob when it comes to MQ, although I've been to a couple of the classes. So Kimbert, I'm not sure how to implement what you suggested. Here is what I came up with that seems to work.
Message Flow: Input Queue (BLOB) --> Compute Node (which grabs the message key and sets the 'MessageType' property) --> RCD(which sets Msg Domain, Msg Set, and Message Format - TDS, didn't even know this existed, thanks Sirsi) --> Compute Node (which converts TDS to XML) --> Output Queue.
In my message set I defined a message to match each of my legacy messages.
Here is my ESQL if you are curious:
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyEntireMessage();
DECLARE i INTEGER 1;
DECLARE msgType CHAR;
DECLARE msgKey CHAR '';
DECLARE msgChar CHAR;
L: WHILE i < 6 DO
SET msgChar = CAST(SUBSTRING(OutputRoot.BLOB.BLOB from i
for 1) AS CHARACTER CCSID 1208);
IF msgChar <> '.' AND msgChar <> ' ' THEN
SET msgKey = msgKey || msgChar;
ELSE
LEAVE L;
END IF;
SET i = i + 1;
END WHILE;
CASE msgKey
WHEN 'QSOR' THEN
SET msgType = 'qsorMessage';
WHEN 'SESUP' THEN
SET msgType = 'sesupMessage';
END CASE;
SET OutputRoot.Properties.MessageType = msgType;
RETURN TRUE;
END;
This seems to be working fine but if there is a more efficient way to do things I'm open to suggestions.
Kimbert, if you can provide some more detail on implementing your solution I'd be interested in that too.
Thanks all. |
|
Back to top |
|
 |
kimbert |
Posted: Wed May 10, 2006 11:15 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Hi,
What you've implemented will work OK, and it's nice and simple. If performance does not matter, I would stick with it.
If you do care about performance, you can use multipart messages, as described in my previous post. Here's a bit more detail.
- Create an extra message definition ( the envelope )
- Within EnvelopeMessage, add an element called 'MessageKey'. Set 'Interpret Value As' to 'MessageIdentity'
- Within EnvelopeMessage, add a group and set the Composition to 'Message'. This represents the remainder of the message ( i.e. everything after the message key )
Each inner message definition needs a unique identifier which matches up with the value of the message key. This is called the 'Message Alias' and it
is set in the Logical properties of the message. |
|
Back to top |
|
 |
alastor52 |
Posted: Thu May 11, 2006 4:42 am Post subject: |
|
|
Apprentice
Joined: 09 May 2006 Posts: 37
|
Hey, that's pretty slick! I got it working and it does seem like a simpler, more efficient solution. Thanks to both you and Sirsi. I've got a better grasp on the way the broker works. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|