From ce54d7e93eba99a074138b9347219035b5d67cce Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Tue, 16 Nov 2010 00:08:09 -0500 Subject: [PATCH] INT-1605 updated aggregator documentatio to reflect new attributes, added more SpEL samples for aggregator's release-strategy-expression as well as correlation-strategy-expression --- docs/src/reference/docbook/aggregator.xml | 209 +++++++++++++--------- 1 file changed, 127 insertions(+), 82 deletions(-) diff --git a/docs/src/reference/docbook/aggregator.xml b/docs/src/reference/docbook/aggregator.xml index b37f0b0e1d..6ed365cb08 100644 --- a/docs/src/reference/docbook/aggregator.xml +++ b/docs/src/reference/docbook/aggregator.xml @@ -305,28 +305,38 @@ Spring Integration supports the configuration of an aggregator via XML through the <aggregator/> element. Below you can see an example - of an aggregator with all optional parameters defined. + of an aggregator. - - + ]]> + + + + + + @@ -335,96 +345,103 @@ ]]> - + The id of the aggregator is optional. - - The input channel of the aggregator. + + Lifecycle attribute signaling if aggregator should be started during Application Context startup. + Optional (default is 'true'). + + + + The channel where aggregator will receive messages from Required. - + The channel where the aggregator will send the aggregation results. Optional (because incoming messages can specify a - reply channel themselves). + reply channel themselves via 'replyChannel' Message Header). - + The channel where the aggregator will send the messages that - timed out (if send-partial-results-on-timeout is + timed out (if send-partial-results-on-expiry is false). Optional. - - A reference to a bean defined in the application context. The - bean must implement the aggregation logic as described above. - Required. - - - - A method defined on the bean referenced by ref, - that implements the message aggregation - algorithm. Optional, with restrictions (see - above). - - - - A reference to a bean that implements the decision algorithm as - to whether a given message group is complete. The bean can be an - implementation of the CompletionStrategy interface or a POJO. In the - latter case the completion-strategy-method attribute must be defined - as well. Optional (by default, the aggregator will use - sequence size) . - - - - A method defined on the bean referenced by - release-strategy, that implements the - completion decision algorithm. Optional, with - restrictions (requires completion-strategy to be - present). - - - - A reference to a bean that implements the correlation strategy. - The bean can be an implementation of the CorrelationStrategy interface - or a POJO. In the latter case the correlation-strategy-method - attribute must be defined as well. Optional (by default, the - aggregator will use the correlation id header attribute) - . - - - - A method defined on the bean referenced by - correlation-strategy, that implements the - correlation key algorithm. Optional, with - restrictions (requires correlation-strategy to be - present). - - - + A reference to a MessageGroupStore that can be used to store groups of messages under their correlation key until they are complete. Optional with default a volatile in-memory store. - - - Whether upon the expiration of the message group, the aggregator - will try to aggregate the messages that have already arrived. - Optional (false by default). + + + Order of this aggregator in when more then one aggregator is subscribig to the same DirectChannel + (use for load balancing purposes) + Optional. - - + + + Tells if partially aggregated messages should be released when their storage time had expired + (see MessageGroupStore.expireMessageGroups(long)) + Optional. + + + The timeout for sending the aggregated messages to the output or reply channel. Optional. - - SpEL expression to handle release strategy Optional. + + A reference to a bean that implements the decision algorithm as + to whether a given message group is complete. The bean can be an + implementation of the CorrelationStrategy interface or a POJO. In the + latter case the correlation-strategy-method attribute must be defined + as well. Optional (by default, the aggregator will use + sequence size) . + + + A method defined on the bean referenced by + correlation-strategy, that implements the + correlation decision algorithm. Optional, with + restrictions (requires correlation-strategy to be + present). + + + + A reference to a bean defined in the application context. The bean must implement the aggregation logic + as described above.Optional (by default the list of aggregated Messages will become a + payload of the output message). + + + + A method defined on the bean referenced by ref, + that implements the message aggregation + algorithm. Optional, depends on ref attribute being defined. + + + + A reference to a bean that implements the release strategy. + The bean can be an implementation of the ReleaseStrategy interface + or a POJO. In the latter case the release-strategy-method + attribute must be defined as well. Optional (by default, the + aggregator will use the correlation id header attribute) + . + + + + A method defined on the bean referenced by + release-strategy, that implements the + completion decision algorithm. Optional, with + restrictions (requires release-strategy to be + present). + + Using a "ref" attribute is generally recommended if a custom @@ -529,6 +546,34 @@ assemble a new collection from the payloads of all messages in the list and then transforming it to an Array, thus achieving the same result as the java code above. + + + The same expression-based approach could be applied when dealing with custom Release and + Correlation strategies. + Instead of defining a bean for custom CorrelationStrategy via correlation-strategy + attribute you can implement your simple correlation logic via SpEL expression and configure it via + correlation-strategy-ecpression attribute. + + + For example: + + + + In the above example it is assumed that the payload has an attribute person with an id + which is going to be used to correlate messages. + + + And when it comes to ReleaseStrategy you can implement your release logic via + SpEL expression as well and configure it via release-strategy-expression attribute. + + + For example: + + 5"]]> + + In this example the root of SpEL Evaluation Context is MessageGroup and you simply stating + that as soon as there are more then 5 messages in this group release the group. +