diff --git a/spring-integration-reference/src/aggregator.xml b/spring-integration-reference/src/aggregator.xml index e23d1b1424..b435da251f 100644 --- a/spring-integration-reference/src/aggregator.xml +++ b/spring-integration-reference/src/aggregator.xml @@ -23,10 +23,10 @@
Functionality - The Aggregator combines a group of related messages, by storing and - grouping them, until the group is deemed complete. At that point, the + The Aggregator combines a group of related messages, by correlating + and storing them, until the group is deemed complete. At that point, the Aggregator will create a single message by processing the whole group, and - will send the result message further. + will send that aggregated message as output. As messages might arrive with a certain delay (or certain messages from the group might not arrive at all), the Aggregator can specify a @@ -41,7 +41,7 @@ In Spring Integration, the grouping of the messages for aggregation is done by default based on their CORRELATION_ID message header (i.e. the messages with the same CORRELATION_ID will be grouped together). However, - this can be customized, and the users can opt for different other ways of + this can be customized, and the users can opt for other ways of specifying how the messages should be grouped together, by using a CorrelationStrategy (see below). @@ -82,8 +82,8 @@ message sequence to aggregate is complete and processing them afterwards, and implementing the timeout functionality. The responsibility of deciding how the messages should be grouped together - is delegated to a CorrelationStrategy instance. The responsibility of - deciding whether the message sequence is complete is delegated to a + is delegated to a CorrelationStrategy instance. The responsibility + of deciding whether the message sequence is complete is delegated to a CompletionStrategy instance. A brief highlight of the base @@ -187,7 +187,7 @@ SequenceSizeCompletionStrategy. This implementation uses the SEQUENCE_NUMBER and SEQUENCE_SIZE of the arriving messages for deciding when a message group is complete and ready to be - aggregated. + aggregated.
@@ -209,10 +209,10 @@ In general, any ordinary Java class (i.e. POJO) can implement the correlation decision mechanism, and the rules for mapping a message to - method's argument (or arguments) are the same as for a + a method's argument (or arguments) are the same as for a ServiceActivator (including support for @Header annotations). The method must return a value, and the value must not be - null. + null. Spring Integration provides an out-of-the box implementation for CorrelationStrategy, the @@ -243,7 +243,7 @@ completion-strategy-method="checkCompleteness" correlation-strategy="correlationStrategyBean" - correlation-strategy-method="correlationStrategyMethod" timeout="42" send-partial-result-on-timeout="true" @@ -255,7 +255,9 @@ <bean id="aggregatorBean" class="sample.PojoAggregator"/> -<bean id="completionStrategyBean" class="sample.PojoCompletionStrategy"/> +<bean id="completionStrategyBean" class="sample.PojoCompletionStrategy"/> + +<bean id="correlationStrategyBean" class="sample.PojoCorrelationStrategy"/> @@ -277,7 +279,7 @@ The channel where the aggregator will send the messages that timed out (if send-partial-results-on-timeout is - false). Optional. + false). Optional. @@ -288,8 +290,8 @@ A method defined on the bean referenced by ref, - that implements the message aggregation - algorithm. Optional, with restrictions (see + that implements the message aggregation + algorithm. Optional, with restrictions (see above). @@ -304,8 +306,8 @@ A method defined on the bean referenced by - completion-strategy, that implements - the completion decision algorithm. Optional, with + completion-strategy, that implements the + completion decision algorithm. Optional, with restrictions (requires completion-strategy to be present). @@ -321,8 +323,8 @@ A method defined on the bean referenced by - correlation-strategy, that implements - the completion decision algorithm. Optional, with + correlation-strategy, that implements the + correlation key algorithm. Optional, with restrictions (requires correlation-strategy to be present). @@ -393,13 +395,13 @@ public class PojoCorrelationStrategy { ... - public Long groupsNumbersByLastDigit(Long number) { + public Long groupNumbersByLastDigit(Long number) { return number % 10; } } For example, this aggregator would group numbers by some criterion - (in our case the remainder by dividing to 10) and will hold on the group + (in our case the remainder after dividing by 10) and will hold the group until the sum of the numbers which represents the payload exceeds a certain value. @@ -427,7 +429,7 @@ ... } - @CompletionStrategy + @CorrelationStrategy public String correlateBy(OrderItem item) { ... } @@ -450,14 +452,14 @@ An annotation indicating that this method shall be - used as the correlation strategy of an aggregator. If not present of - the method, the aggregator will use the + used as the correlation strategy of an aggregator. If no correlation + strategy is indicated, the aggregator will use the HeaderAttributeCorrelationStrategy based on CORRELATION_ID. - All the configuration options provided by xml element are available - for the @Aggregator annotation. + All the configuration options provided by the xml element are also + available for the @Aggregator annotation. The aggregator can be either referenced explicitly from XML or, if the @MessageEndpoint is defined on the class, detected automatically