| Author | Message | 
		
		  | SpitFire | 
			  
				|  Posted: Wed Jan 18, 2006 12:49 am    Post subject: Multiple types of input messages |   |  | 
		
		  |  Acolyte
 
 
 Joined: 01 Aug 2005Posts: 59
 Location: India
 
 | 
			  
				| Hi all, If in case there is a scenario in which the input messages are of same domain 'MRM', however they can be of different types (Say, Order or Enquiry), how do you model the flow such that if 'Order' comes, then it is routed to a series of nodes, and if 'Enquiry' comes then it is routed through a different set of nodes?
 For differentiating the messages it can be assumed that the first field in the input message provides an idea of what kind of message it is 'Order' or 'Enquiry'.
 Can someone help me out regarding this scenario?
 _________________
 ...: 5|71+ph1|23 :...
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | elvis_gn | 
			  
				|  Posted: Wed Jan 18, 2006 1:24 am    Post subject: |   |  | 
		
		  |  Padawan
 
 
 Joined: 08 Oct 2004Posts: 1905
 Location: Dubai
 
 | 
			  
				| Hi _z33m, 
 You could use a common flow to check what the message is and then route it using the RouteToLabel and Label nodes.
 
 OR
 
 Ok, this is a totally untested logic, i'm not sure if it works....
 
 In message sets one can define Choice....If you have a message Definition with a choice of Order or Enquiry right at the top level, the input message will look at its root tag and map tiself to the corresponding tree structure....I hope
     
 OR
 
 I could not find the link, but i remember reading something on having an additional header over the message, which could be read and the message routed to the correct flow....
 
 The first one i'm definite about.
 
 Regards.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kimbert | 
			  
				|  Posted: Wed Jan 18, 2006 2:30 am    Post subject: |   |  | 
		
		  |  Jedi Council
 
 
 Joined: 29 Jul 2003Posts: 5543
 Location: Southampton
 
 | 
			  
				| I don't advise mangling the message set by constructing a choice of all messages. Keep the logical model pure - its structure should be controlled by how you ( the business ) think about your data, not by the details of a message flow. Otherwise your message set design gets coupled with your message flow design. |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | dipankar | 
			  
				|  Posted: Wed Jan 18, 2006 11:42 pm    Post subject: |   |  | 
		
		  | Disciple
 
 
 Joined: 03 Feb 2005Posts: 171
 
 
 | 
			  
				| It will be better to post the format of input message for understanding. 
 However I think Elvis_gn first method is ok.
 
 Extract first field of the input message by blob or xml parsing depending on the input format. Then use DestinationData to route the message. The message flow would be like
 
 Input-->compute node--RouteToLabel
 
 Label1--->
 
 Label2 --->
 _________________
 Regards
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | Feysn | 
			  
				|  Posted: Thu Jan 19, 2006 1:10 am    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 04 Jun 2004Posts: 33
 Location: Wilrijk
 
 | 
			  
				| _z33 
 Indeed what elvis_gn and dipankar are saying is correct.  I've used this in certain case.  The first few characters of the message are defining which type of message I have.
 
 I read the message as BLOB cast the determination characters and rout then to the correct handling.
 
 But kimbert has a good point.  Try to route the message before and handle in separate flows.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | SpitFire | 
			  
				|  Posted: Thu Jan 19, 2006 11:01 pm    Post subject: BLOB - Casting |   |  | 
		
		  |  Acolyte
 
 
 Joined: 01 Aug 2005Posts: 59
 Location: India
 
 | 
			  
				| Hi all, Thanks for all the information. I shall try to proceed with the info given and then revert back if in case the problem persists.
 _________________
 ...: 5|71+ph1|23 :...
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | SpitFire | 
			  
				|  Posted: Sun Jan 22, 2006 5:46 am    Post subject: Multiple types of input messages - Problem persists |   |  | 
		
		  |  Acolyte
 
 
 Joined: 01 Aug 2005Posts: 59
 Location: India
 
 | 
			  
				| Hi all, I am receiving messages in BLOB format from the 'MQInput' node. After that in a 'Compute' node I am extracting the first two characters and then comparing them against certain values. Based on the values I set the message properties, for further processing over a series of subsequent nodes. This is to make sure that I can send basically two types of messages (belonging to the same message set), and then identify which one was sent using the first two characters (they contain some code for identification).
 
 However, I am not able to change the properties of message header in Compute Node. My ESQL statements in the node are as follows:
 
 
 
   
	| Code: |  
	| CREATE COMPUTE MODULE Check_Msg_Type_Compute
 CREATE FUNCTION Main() RETURNS BOOLEAN
 BEGIN
 -- set message headers
 CALL CopyMessageHeaders();
 
 -- copy message contents
 CALL CopyEntireMessage();
 
 -- set message type
 CALL CheckMsgType();
 RETURN TRUE;
 END;
 
 CREATE PROCEDURE CopyMessageHeaders() BEGIN
 -- copy basic headers from input message
 DECLARE I INTEGER 1;
 DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
 WHILE I < J DO
 SET OutputRoot.*[I] = InputRoot.*[I];
 SET I = I + 1;
 END WHILE;
 
 -- change message headers
 -- to indicate change in message structure
 
 -- set message set
 SET OutputRoot.Properties.MessageSet = 'OG8BJJO002001';
 
 -- set message format
 SET OutputRoot.Properties.MessageFormat = 'TDS1';
 END;
 
 CREATE PROCEDURE CopyEntireMessage() BEGIN
 -- copy entire message from input to output
 SET OutputRoot = InputRoot;
 END;
 
 CREATE PROCEDURE CheckMsgType() BEGIN
 -- message type extracted from the input message
 DECLARE MsgType CHARACTER '';
 
 -- extract first two bytes from the input message
 SET MsgType =
 CAST(
 SUBSTRING(
 InputRoot.BLOB.BLOB FROM 1 FOR 2
 )
 AS CHARACTER
 CCSID InputRoot.Properties.CodedCharSetId
 ENCODING InputRoot.Properties.Encoding
 );
 
 -- set message type
 SET OutputRoot.Properties.MessageType =
 CASE MsgType
 WHEN 'T1' THEN 'MSGTYPE-1'
 WHEN 'T2' THEN 'MSGTYPE-2'
 ELSE ''
 END;
 
 -- check message type set
 IF OutputRoot.Properties.MessageType = '' THEN
 -- throw user exception to indicate error
 THROW USER EXCEPTION
 SEVERITY 3
 CATALOG 'UE-001'
 MESSAGE 3001
 VALUES ('INVALID MESSAGE TYPE');
 END IF;
 
 -- indicate message type to subsequent nodes
 SET Environment.Variables.InputMsgType =
 OutputRoot.Properties.MessageType;
 END;
 END MODULE;
 
 
 CREATE FILTER MODULE Route_Msgs_Filter
 CREATE FUNCTION Main() RETURNS BOOLEAN
 BEGIN
 -- check message type from environment variables
 IF Environment.Variables.InputMsgType = 'MSGTYPE-1' THEN
 RETURN TRUE;
 ELSE
 RETURN FALSE;
 END IF;
 END;
 
 END MODULE;
 
 |  
 I would like to know how to resolve this!
 
 The 'MessageType' value alone changes according to the extracted value from the input message; other values such as the 'MessageSet' and the 'MessageFormat' remains the same. Hence these two values are set the same for all messages.
 
 After this there is a 'Filter' node that tries to identify the message type and then route it accordingly. Then I have a mapping node, in each of the filter node's branches (considering for the moment only 'True' and 'False' branches) that does the transformation of wire format (the mapping actually does nothing other than copy the input to output). But, now since the compute node is not changing the message set & format, the mapping node fails to process the message and I get errors.
 
 Am I overlooking something here?
 _________________
 ...: 5|71+ph1|23 :...
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mgk | 
			  
				|  Posted: Mon Jan 23, 2006 1:26 am    Post subject: |   |  | 
		
		  |  Padawan
 
 
 Joined: 31 Jul 2003Posts: 1647
 
 
 | 
			  
				| You are calling BOTH CopyMessageHeaders and CopyEntireMessage. When you call the second of these it deletes eveything the first call just copied. You should only call ONE of these functions. 
 
 Regards.
 _________________
 MGK
 The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | elvis_gn | 
			  
				|  Posted: Tue Jan 24, 2006 1:36 am    Post subject: |   |  | 
		
		  |  Padawan
 
 
 Joined: 08 Oct 2004Posts: 1905
 Location: Dubai
 
 | 
			  
				| Hi _z33, 
 Do not code anything more inside the CopyMessageHeaders and CopyEntireMessage....These are standard methods, suppose tomorrow u give ur code to some other person, simply by seeing the CALL he should understand what would be happening inside....
 
 Regards.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |