Author |
Message
|
MBLearner |
Posted: Fri Jan 20, 2006 10:05 am Post subject: Separating messages of different domain (MRM, BOLB, XML) |
|
|
Novice
Joined: 20 Jan 2006 Posts: 23
|
I have a message flow which will receive messages of different domain like MRM, BLOB or XML. I would like to filter the messages according to their domain. But the problem is "InputRoot.Properties.MessageDomain" is not a valid correlation hence it's giving NULL when it's being compared. How do I separate the messages according to their domain. can anyone give me any suggestion.
Thanks in Advance. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jan 20, 2006 10:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Please show your ESQL.
And please read about field names and the proper use of single and double-quotes. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
MBLearner |
Posted: Fri Jan 20, 2006 11:06 am Post subject: |
|
|
Novice
Joined: 20 Jan 2006 Posts: 23
|
Thanks for your reply.
What I am trying to achieve is to pass all messages (of different domain also) to a single flow where within the compute node I am trying to set the Input Queue Name in the usr folder of the RFH2. After this being set, I tried to set the message body. Now it is required to check the message domain of the messages. ESQL code is given below. Please let me know if you need any other information.
CREATE COMPUTE MODULE sub_Set_MQRFH2_usr_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- Copy Message Header
CALL CopyMessageHeaders();
-- Set usr Folder
CALL PROC_SetMQRFH2Usr();
-- Copy Message Body
CALL PROC_CopyMessageBody();
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
CREATE PROCEDURE PROC_SetMQRFH2Usr() BEGIN
-- Set Input Queue name to usr folder
SET OutputRoot.MQRFH2.usr.InputQueueName = InputRoot.MQMD.SourceQueue;
END;
CREATE PROCEDURE PROC_CopyMessageBody() BEGIN
-- Set message body
IF InputRoot.Properties.MessageDomain = 'MRM' THEN
SET OutputRoot.MRM = InputRoot.MRM;
END IF;
IF InputRoot.Properties.MessageDomain = 'XML' THEN
SET OutputRoot.XML = InputBody;
END IF;
IF InputRoot.Properties.MessageDomain = 'BLOB' THEN
SET OutputRoot.BLOB = InputRoot.BOLB;
END IF;
END;
END MODULE; |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jan 20, 2006 11:21 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The only way that these InputRoot Properties will be set is if the messages include an MQRFH2 that specific them.
If the messages do not include an MQRFH2, then WBIMB will set these properties to the default settings on the MQInput node. And if those are blank, then the fields will be NULL (and thus not exist).
So I don't think you can do what you want to do the way you're trying to do it.
You can, however, use the COALESCE function to force a value to be not null.
So you could do
Code: |
Set Environment.Variables.MessageDomain = COALESCE(InputRoot.Properties.MessageDomain, "NONE"); |
And then check to see if Environment.Variables.MessageDomain has what you want, or is the fixed value "NONE". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
MBLearner |
Posted: Fri Jan 20, 2006 11:48 am Post subject: |
|
|
Novice
Joined: 20 Jan 2006 Posts: 23
|
My objective is to add only one field (Input Queue Name in this case) in the header information (usr of RFH2) of the messages. But I cannot set the header information after calling CopyEntireMessage(). So I need to set header information first and then Message Body information. Is there any other way to achieve this?
Anyway, Thanks again for your reply. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jan 20, 2006 12:01 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Well, you can set the header information after calling CopyEntireMessage.
You just have to know how to do it properly - using perhaps CREATE to create the header information in the proper place, rather than using Set to add it at the end.
But, as I explained, if the messages don't have an RFH2, then you won't be able to tell what MessageDomain they are in.
If they do have an RFH2, then you can use CREATE to create the usr folder in the proper place in the tree - and you can ignore the MessageDomain entirely. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JT |
Posted: Fri Jan 20, 2006 12:04 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
But I cannot set the header information after calling CopyEntireMessage(). |
Why not ? |
|
Back to top |
|
 |
MBLearner |
Posted: Fri Jan 20, 2006 1:31 pm Post subject: |
|
|
Novice
Joined: 20 Jan 2006 Posts: 23
|
Thank you very much for your information. In this case the flow may receive messages without the RFH2 structure. So, it would be difficult to create RFH2 structure after calling CopyEntireMessage() for those messages. Can u pls suggest me how can I send a information (say, a queue name) in the message header for messages which do not have RFH2 structure. Can I set OutputRoot.MQMD.ReplyToQ after CopyEntireMessage() ?
Following code is working for messages which already have RFH2 header info:
CALL CopyEntireMessage();
CREATE FIELD OutputRoot.MQRFH2.usr.InputQueueName;
SET OutputRoot.MQRFH2.usr.InputQueueName = InputRoot.MQMD.SourceQueue; |
|
Back to top |
|
 |
|