Use the Fan In mediation primitive to help you combine multiple messages.
The Fan In mediation primitive helps you combine multiple messages, which you create using the Fan Out mediation primitive.
The Fan In mediation primitive has two input terminals (in and stop), two output terminals (out and incomplete) and a fail terminal (fail). The input terminals are wired to accept a message and the other terminals are wired to propagate a message.
If an exception occurs during the processing of the input message, the fail terminal propagates the input message, together with any exception information.
The in terminal accepts input messages until a decision point is reached. When a decision point is reached the out terminal is fired. Although the out terminal is fired when a decision point is reached, the in terminal can still accept input messages, under some circumstances. For example, if the count value is reached, the out terminal is fired. However, if the Fan Out mediation primitive is still sending messages, the Fan In mediation primitive can still receive messages.
You can stop a Fan In operation by wiring the preceding mediation primitive to the Fan In stop terminal. The stop terminal causes the incomplete output terminal to be fired, and this stops the associated Fan Out primitive from sending any more messages. The incomplete output terminal is also fired if a timeout occurs.
When the out terminal, of the Fan In primitive, is fired it propagates the last message received on its in terminal. The shared context is also propagated; it is the shared context area of the service message object (SMO) that enables the aggregation facility. However, in order to aggregate data you must transform, or map, the information in the message, and shared context, into a form appropriate for the flow downstream of the Fan In mediation primitive. Equally, you might need to transform, or map, information from the shared context after the Fan Out mediation primitive, before wiring paths to the in terminal of the Fan In mediation primitive.
The Fan In primitive can only be used in combination with the Fan Out mediation primitive and, therefore, must always have an associated Fan Out mediation primitive. WebSphere® Integration Developer allows you to select which Fan Out mediation primitive to associate with each Fan In mediation primitive, and displays the associated Fan Out primitive next to the details of the Fan In properties.
The Fan In mediation primitive lets you wait until certain conditions are met, before processing information created previously in the mediation flow. In this way, the Fan In primitive lets you create various decision points, (based upon counts, XPath evaluations and iterations), it does not change the input message in any way.
After the Fan In primitive you might want to transform, or map, information from the shared context into the body of the message, (the SMO /body). Alternatively, you might want to augment the existing type of the message, with aggregated information. In order to do this you must use another mediation primitive after the Fan In. For example, you might use an XSLT mediation primitive to map information from the shared context into another part of the message.
You can use the Fan Out and Fan In mediation primitives to aggregate (combine) the responses from two service invocations into one output message. For example, you could retrieve a customer credit score from two credit agencies, then average the two scores.
The shared context area of the SMO is a global storage area you can use to aggregate data. The shared context is a thread-based storage area: it is shared by all SMOs that are created for a particular thread. However, the shared context business object does not persist across a request and response flow, through callout invocation; whatever data is in the shared context of the request flow cannot be reused during the response flow.
Like the transient and correlation context, the shared context is defined as a user-provided business object on the input node of the mediation flow. After you have defined the shared context you can use it to store data during aggregation operations. You need to design the shared context business object carefully, to ensure it is suitable for all aggregation scenarios in a specific flow.
You can stop a Fan In operation by wiring a preceding mediation primitive the stop input terminal, for instance if a Service Invocation between the Fan Out and Fan In fails. This will cause the incomplete terminal to be fired, and will stop the corresponding Fan Out primitive from firing any more messages.
Property | Valid Values | Default | |
---|---|---|---|
Decision type | Count | Integer | 1 |
XPath | Valid XPath | ||
Iterate | Boolean: true or false | ||
Timeout | Integer | -1 |
Consider the following when using the Fan In mediation primitive: