If you are using WebSphere MQ as the transport protocol for your aggregation flows, you can correlate the initial request message with the combined response message by preserving the MsgId from the input MQMD and using it as the CorrelId of the output response.
Before you start:
To complete this task, you must have completed the following tasks:
When the initial request is processed by the fan-out flow, the MsgId held in the MQMD is lost. If you want to correlate the aggregated output message to the original input message, one way to do this is to preserve the MsgId and specify it as the CorrelId in the aggregated output message.
The task described here assumes that you have already created a fan-out flow and a fan-in flow as two separate flows that run on the same broker. It also assumes the minimum content for these flows; your flows can include whatever content is appropriate, and you can adapt them in the way that is shown here to add this additional function.
CREATE COMPUTE MODULE SaveMsgId CREATE FUNCTION Main() RETURNS BOOLEAN BEGIN CALL CopyMessageHeaders(); // Extract and preserve the MsgId of the original request message SET OutputRoot.XML.MyMsgId = InputRoot.MQMD.MsgId; 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; END MODULE;
SET OutputRoot.MQMD.Version = MQMD_CURRENT_VERSION; // Store the saved MQMD MsgId value from the specified folder in MQMD CorrelId field SET OutputRoot.MQMD.CorrelId = CAST(InputRoot.ComIbmAggregateReplyBody.SavedMSGID.XML.MyMsgId AS BLOB);The example fan-out flow is shown below; the Compute node SetCorrelID processes the replies to create a combined response message, and now sets the MQMD correlation identifier to associate this response with the initial request:
Related concepts
Message flows
Message flow aggregation
Related tasks
Configuring aggregation flows
Designing a message flow
Creating a message flow
Defining message flow content
Related reference
AggregateControl node
AggregateReply node
AggregateRequest node
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ac20410_ |