This post only shows how to use this node & how output tree populates from input & result trees.
As we know MQGet node can be used anywhere in a message flow to store message in intermediate state & afterwords in another thread of flow we can aggregate this temporary result to form final output (Getting message by correl/message id..)
Following example illustrates how an intermediate message can be combined to incoming message to form final message.
First Flow : IN (MQInput) , TEMP (MQOutput)
Second Flow : IN2 (MQInput), TEMP (MQGet), OUT (MQOutput)
Here the Compute node copies the message id of the incoming message to correlation id of output message, so that we can retrieve this intermediate message based on correlation id.
SET OutputRoot.MQMD.CorrelId = InputRoot.MQMD.MsgId;
Three different input for first flow is : (Put in IN QUEUE)
<Project>PD1</Project> Say MsgId is (ABCXX)
<Project>PD2</Project> Say MsgId is (ABCYY)
<Project>PD3</Project> Say MsgId is (ABCZZ)
Same data is being put in TEMP (Output) queue after copying its MsgId to CorrelId.
Input to the second flow is : (Put in IN2 QUEUE)
<Employee>
<NAME>HARISH</NAME>
<ProjectDetails>PD</ProjectDetails>
</Employee>
Note : Passed correlId is ABCXX (MsgId of PD1)
Now we can see the property of the MQGet (TEMP) node, Get by CorrelationID is checked; it means whatever message we put in TEMP queue , we can get based on correlId.
Next is to form the output tree from input & result trees.
The content of Employee.ProjectDetails will be replace by the content of Project (present in TEMP queue from first flow)
Final output will be :
<Employee>
<NAME>HARISH</NAME>
<ProjectDetails>PD1</ProjectDetails>
</Employee>
As we know MQGet node can be used anywhere in a message flow to store message in intermediate state & afterwords in another thread of flow we can aggregate this temporary result to form final output (Getting message by correl/message id..)
Following example illustrates how an intermediate message can be combined to incoming message to form final message.
First Flow : IN (MQInput) , TEMP (MQOutput)
Second Flow : IN2 (MQInput), TEMP (MQGet), OUT (MQOutput)
Here the Compute node copies the message id of the incoming message to correlation id of output message, so that we can retrieve this intermediate message based on correlation id.
SET OutputRoot.MQMD.CorrelId = InputRoot.MQMD.MsgId;
<Project>PD1</Project> Say MsgId is (ABCXX)
<Project>PD2</Project> Say MsgId is (ABCYY)
<Project>PD3</Project> Say MsgId is (ABCZZ)
Same data is being put in TEMP (Output) queue after copying its MsgId to CorrelId.
Input to the second flow is : (Put in IN2 QUEUE)
<Employee>
<NAME>HARISH</NAME>
<ProjectDetails>PD</ProjectDetails>
</Employee>
Note : Passed correlId is ABCXX (MsgId of PD1)
Now we can see the property of the MQGet (TEMP) node, Get by CorrelationID is checked; it means whatever message we put in TEMP queue , we can get based on correlId.
Next is to form the output tree from input & result trees.
The content of Employee.ProjectDetails will be replace by the content of Project (present in TEMP queue from first flow)
Final output will be :
<Employee>
<NAME>HARISH</NAME>
<ProjectDetails>PD1</ProjectDetails>
</Employee>
this was a simple and easy to understand sample. it was very useful
ReplyDelete-- CALL CopyMessageHeaders();
ReplyDeleteCALL CopyEntireMessage();
SET OutputLocalEnvironment.Destination.FILE ='C:\FILELAB\FILE_IN';
SET OutputLocalEnvironment.MQ.GET.QueueName = 'GET';
SET OutputLocalEnvironment.CorrelId = InputLocalEnvironment.MsgId;
Is dis code correct...am trying to get a message from a Q and put it back with the CorrelId
This comment has been removed by the author.
ReplyDeleteI have followed the same above process, even I have used same properties and same input but still I am getting the below exception..
ReplyDeleteplz solve my issue
RecoverableException
File:CHARACTER:F:\build\slot1\S000_P\src\DataFlowEngine\MQLibrary\linklib\ImbMqGetNode.cpp
Line:INTEGER:1126
Function:CHARACTER:ImbMqGetNode::evaluate
Type:CHARACTER:ComIbmMQGetNode
Name:CHARACTER:GET_FLOW#FCMComposite_1_5
Label:CHARACTER:GET_FLOW.MQ Get
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:4631
Text:CHARACTER:Failed to find result data location. Location specified was: '&1'.
Insert
Type:INTEGER:5
Text:CHARACTER:ResultRoot.XMLNSC.Project
Insert
Type:INTEGER:5
Text:CHARACTER:Result Data Location
You saved lot of time for me. Thank you
ReplyDeleteiam also getting same error how to solve it
ReplyDeleteGreat and I have a super provide: Who Does House Renovation house renos
ReplyDeleteGreat and that i have a nifty offer: House Renovation What Order home renovation companies
ReplyDelete