Aggregate Mediator
The Aggregate Mediator implements the Message Aggregator EIP and will aggregate the messages or responses for splitted messages using either the clone or iterate mediators. At the same time it can aggregate messages on the presence of matching elements specified by the correlateOn XPATH
expression. Aggregate will collect the messages coming into it until the messages collected on the aggregation satisfies the complete condition. The completion condition can specify a minimum or maximum number of messages to be collected, or a timeout value in seconds, after which the aggregation terminates. On completion of the aggregation it will merge all of the collected messages and invoke the onComplete
sequence on it. The merged message would be created using the XPath expression specified by the attribute expression
on the onComplete
element.
Syntax
<aggregate> <correlateOn expression="xpath"/>? <completeCondition [timeout="time-in-seconds"]> <messageCount min="int-min" max="int-max"/>? </completeCondition>? <onComplete expression="xpath" [sequence="sequence-ref"]> (mediator +)? </onComplete> </aggregate>
UI Configuration
The Aggregate Mediator field descriptions:
- Aggregate ID - This optional attribute can be used to aggregate only responses for splitted messages that are created by a specific clone/iterate mediator. Aggregate ID should be same as the ID of the corresponding clone/iterate mediator that creates splitted messages. This is particularly useful when aggregating responses of messages that are created using nested clone/iterate mediators.
- Aggregation Expression - An XPath expression specifying based on which elements to aggregate. Set of messages that's taken for aggregation is determined through Correlation Expression.
- Completion Timeout - Time that the aggregator waits for messages.
- Completion Max-messages - Maximum number of messages that can exist in an aggregation.
- Completion Min-messages - Minimum number of messages required for the aggregation to complete.
- Correlation Expression - An XPath expression specifying the pattern messages will be collected for aggregation. Specific aggregation condition will be set through Aggregation Expression.
Tip
You can click the "NameSpaces" link to add namespaces if you are providing an expression. You will be provided another panel named "Namespace Editor", where you can provide any number of namespace prefixes and URL that you have used in the XPath expression. See Common Screens and Dialog Boxes.
- On Complete:
- Anonymous
- Pick From Registry - The Path can be chosen from Configuration Registry or Governance Registry. See more information abut the Registry Browser in Namespace.
Note
You can configure the Mediator using XML. Click on "switch to source view" in the "Mediator" window.
Example
<outSequence> <aggregate> <onComplete expression="//m0:getQuoteResponse" xmlns:m0="http://services.samples"> <send/> </onComplete> </aggregate> </outSequence>
In this example, the Mediator aggregates the responses coming in to ESB and on completion it sends the aggregated message through the Send Mediator.