|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Multi Message Problem - PROPAGATE |
« View previous topic :: View next topic » |
Author |
Message
|
aspre1b |
Posted: Fri Oct 31, 2008 5:52 am Post subject: Multi Message Problem - PROPAGATE |
|
|
 Voyager
Joined: 05 Jul 2007 Posts: 78 Location: Coventry, UK
|
I’m looking for a little guidance, my scenario is this:
I have a system that kicks out 19 different event messages in cobol copybook format. I have modelled these and I have no problem processing these (I convert them into a canonical XML format and publish them).
I have another type of event message (multi message) that is a concatenation of any of the previous 19 message types. It also has a header (start of the data, not in the usr folder) that describes the number of messages, length of each message and the type of each message.
I have successfully created an MRM to model the multi message format.
[No of types][TypeLength][Type,Length][Type,Length][Type,Length][ FLS DATA / RestMsg]
I plan to chop up the multi message into many messages using PROPAGATE and process them the same as the other 19 event messages. I would prefer to convert each message back into a BLOB and send it back into the event dispatcher.
The alternative was to populate each message type manually, but this would take a while to code.
Sample of my code below:
Code: |
CALL CopyMessageHeaders();
/**********************************************************************************************************************
* msg = length of fixed length message 0000
* restMsg = rest of the message(s) minus the header information which includes the fixed length and data type
* msgType = message type 0000
*
* [No of types][TypeLength][Type,Length][Type,Length][Type,Length][ FLS DATA / RestMsg]
***********************************************************************************************************************/
DECLARE inRef REFERENCE TO InputRoot.MRM;
DECLARE msgLength INTEGER;
DECLARE myChar, restMsg, msgType,messageType CHARACTER;
DECLARE msgSetID,formatType,BH_Class CHARACTER;
DECLARE myBlob,myBlob2 BLOB;
DECLARE blobLength,restMsgLength INTEGER;
DECLARE blobRef REFERENCE TO Environment.BLOB.BLOB;
SET restMsg = inRef.REST;
--Set headRef to the current msg
DECLARE headRef REFERENCE TO inRef.MSG_HEAD[1];
--Cycle through msg headers and extract message from restMsg
WHILE LASTMOVE(headRef) DO
SET msgLength = headRef.MLENGTH;
SET msgType = TRIM(headRef.MTYPE);
--Get current msg from restMsg
SET myChar = SUBSTRING (restMsg FROM 1 FOR msgLength);
SET OutputLocalEnvironment.myChar = myChar; -- maybe not needed
--Perform msgType and msgSet lookup
CALL LookupMsgType(msgType,msgSetID,formatType,BH_Class,messageType);
--Set BH_Class field of the extracted msg
SET "OutputRoot"."MQRFH2"."usr"."BH_Class" = BH_Class;
SET blobLength = 0;
SET restMsgLength = 0;
SET blobLength = LENGTH(blobRef);
SET restMsgLength = LENGTH(inRef.REST);
SET OutputRoot.Properties.MessageDomain = 'BLOB';
--Remove current msg from restMsg
SET restMsg = SUBSTRING(restMsg FROM (msgLength + 1));
--Propagate msg and reset the environment tree
CALL PropagateEnvironment(inRef);
CALL CopyMessageHeaders();
--Move headRef to next msg header
MOVE headRef NEXTSIBLING REPEAT TYPE NAME;
END WHILE;
RETURN FALSE; |
NB: I've got a copy of the original BLOB multi message in the environment tree.
Any help would be appreciated. |
|
Back to top |
|
 |
aspre1b |
Posted: Fri Oct 31, 2008 6:32 am Post subject: |
|
|
 Voyager
Joined: 05 Jul 2007 Posts: 78 Location: Coventry, UK
|
Can an administrator please delete this as it should be in the WBIMB section. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Oct 31, 2008 2:51 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
If you are trying to make the parsing easy, then your 'multi-message' format is not ideal. This would be better:
Code: |
MessageType1, Message1, MessageType2, Message2, MessageType3, Message3... |
Note the following:
- Each message type is grouped with its message
- There is no need for a length field. The MRM's on-demand parsing ensures that parsing stops at the end of each message ( assuming that none of your messages ends with a variable-length field ).
If you use the structure suggested above, then you can use the Message Alias / Interpret Value As method to identify each message. See here for details: http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ad00761_.htm
Your message model would look something like this:
Code: |
MultiMessage
Group minOccurs=0 maxOccurs=-1
element Name="MessageType" InterpretValueAs="Message Identity"
Group Composition="InnerMessage" |
The advantage of this approach is that you can throw away all of your ESQL parsing code, and let the MRM parser take the strain. I'm assuming two things here:
- you have complete control of the multi-message format
- you are on v6 or later. |
|
Back to top |
|
 |
aspre1b |
Posted: Sun Nov 02, 2008 11:38 pm Post subject: |
|
|
 Voyager
Joined: 05 Jul 2007 Posts: 78 Location: Coventry, UK
|
Thanks for your reply, unfortunately I'm using Broker 5.3 CSD 8, MQ 5 CSD 12.
I thought I had put this on the original post, it looks like I forgot. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 03, 2008 2:29 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
If your message contains only character data then you can do the same trick using TDS instead of CWF. In fact, the v6.0 message alias/message identity feature is simply an extension of the v5 TDS message key feature. |
|
Back to top |
|
 |
aspre1b |
Posted: Tue Nov 04, 2008 2:35 am Post subject: |
|
|
 Voyager
Joined: 05 Jul 2007 Posts: 78 Location: Coventry, UK
|
Unfortunately I do not have control of the message. It is fixed to be this format:
[No of types][TypeLength][Type,Length][Type,Length][Type,Length][ FLS DATA / RestMsg] |
|
Back to top |
|
 |
aspre1b |
Posted: Thu Nov 06, 2008 7:50 am Post subject: |
|
|
 Voyager
Joined: 05 Jul 2007 Posts: 78 Location: Coventry, UK
|
I've simply propagated into the MRM domain, using my existing copybook. There was a problem with my copybook, which I had to twiddle to get working, but it all works fine now.
Cheers for your help. |
|
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
|
|
|
|