INT-4377: aggregator groupTimeout as Date (#3505)
* INT-4377: aggregator groupTimeout as Date JIRA: https://jira.spring.io/browse/INT-4377 Change the `groupTimeoutExpression` logic to let it to be evaluated to `Date` instance for some fine-grained scheduling use-case, e.g. to determine a scheduling moment from the group creation time (`timestamp`) instead of a current message arrival * Fix language in docs accoridng PR review Co-authored-by: Gary Russell <grussell@vmware.com> Co-authored-by: Gary Russell <grussell@vmware.com>
This commit is contained in:
@@ -691,7 +691,7 @@ In the preceding example, the root object of the SpEL evaluation context is the
|
||||
[[agg-and-group-to]]
|
||||
====== Aggregator and Group Timeout
|
||||
|
||||
Starting with version 4.0, two new mutually exclusive attributes have been introduced: `group-timeout` and `group-timeout-expression` (see the earlier description).
|
||||
Starting with version 4.0, two new mutually exclusive attributes have been introduced: `group-timeout` and `group-timeout-expression`.
|
||||
See <<aggregator-xml>>.
|
||||
In some cases, you may need to emit the aggregator result (or discard the group) after a timeout if the `ReleaseStrategy` does not release when the current message arrives.
|
||||
For this purpose, the `groupTimeout` option lets scheduling the `MessageGroup` be forced to complete, as the following example shows:
|
||||
@@ -721,6 +721,16 @@ The reaper initiates forced completion for all `MessageGroup` s in the `MessageG
|
||||
The `groupTimeout` does it for each `MessageGroup` individually if a new message does not arrive during the `groupTimeout`.
|
||||
Also, the reaper can be used to remove empty groups (empty groups are retained in order to discard late messages if `expire-groups-upon-completion` is false).
|
||||
|
||||
Starting with version 5.5, the `groupTimeoutExpression` can be evaluated to a `java.util.Date` instance.
|
||||
This can be useful in cases like determining a scheduled task moment based on the group creation time (`MessageGroup.getTimestamp()`) instead of a current message arrival as it is calculated when `groupTimeoutExpression` is evaluated to `long`:
|
||||
|
||||
====
|
||||
[source,xml]
|
||||
----
|
||||
group-timeout-expression="size() ge 2 ? new java.util.Date(timestamp + 200) : null"
|
||||
----
|
||||
====
|
||||
|
||||
[[aggregator-annotations]]
|
||||
===== Configuring an Aggregator with Annotations
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@ The `ConsumerEndpointFactoryBean` now accept a `reactiveCustomizer` `Function` t
|
||||
This is covered as a `ConsumerEndpointSpec.reactive()` option in Java DSL and as a `@Reactive` nested annotation for the messaging annotations.
|
||||
See <<./reactive-streams.adoc#reactive-streams,Reactive Streams Support>> for more information.
|
||||
|
||||
The `groupTimeoutExpression` for a correlation message handler (an `Aggregator` and `Resequencer`) can now be evaluated to a `java.util.Date` for some fine-grained scheduling use-cases.
|
||||
See <<./aggregator.adoc#aggregator,Aggregator>> for more information.
|
||||
|
||||
[[x5.5-amqp]]
|
||||
==== AMQP Changes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user