Sunday 5 January 2014

MQGet Node Example Flow of WebSphere Message Broker


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>

No comments:

Post a Comment