INT-4452: Expire immediately when group timeout<0

JIRA: https://jira.spring.io/browse/INT-4452

This is pretty typical in practice to get a `groupTimeout` to be
evaluated to a negative value: some business decisions, sensitive
calculations and so on.

* Treat any non-positive `groupTimeout` as a signal to expire group
immediately without scheduling.
Only `null` is considered as a signal do nothing for the current message
* Polishing for some tests for better performance - saves some execution
time
This commit is contained in:
Artem Bilan
2018-06-22 17:12:50 -04:00
committed by Gary Russell
parent ee501c801f
commit 13510df575
15 changed files with 161 additions and 121 deletions

View File

@@ -477,8 +477,8 @@ See <<redis-lock-registry>>, <<gemfire-lock-registry>>, <<zk-lock-registry>> for
This attribute provides a built-in _Time-base Release Strategy_ for the aggregator, when there is a need to emit a partial result (or discard the group), if a new Message does not arrive for the `MessageGroup` within the timeout.
When a new Message arrives at the aggregator, any existing `ScheduledFuture<?>` for its `MessageGroup` is canceled.
If the `ReleaseStrategy` returns `false` (don't release) and the `groupTimeout > 0` a new task will be scheduled to expire the group.
Setting this attribute to zero is not advised because it will effectively disable the aggregator because every message group will be immediately completed.
It is possible, however to conditionally set it to zero using an expression; see `group-timeout-expression` for information.
Setting this attribute to zero (or negative value) is not advised because it will effectively disable the aggregator because every message group will be immediately completed.
It is possible, however to conditionally set it to zero (or negative value) using an expression; see `group-timeout-expression` for information.
The action taken during the completion depends on the `ReleaseStrategy` and the `send-partial-group-on-expiry` attribute.
See <<agg-and-group-to>> for more information.
Mutually exclusive with 'group-timeout-expression' attribute.
@@ -486,7 +486,7 @@ Mutually exclusive with 'group-timeout-expression' attribute.
<22> The SpEL expression that evaluates to a `groupTimeout` with the `MessageGroup` as the `#root` evaluation context object.
Used for scheduling the `MessageGroup` to be forced complete.
If the expression evaluates to null or `< 0`, the completion is not scheduled.
If the expression evaluates to `null`, the completion is not scheduled.
If it evaluates to zero, the group is completed immediately on the current thread.
In effect, this provides a dynamic `group-timeout` property.
See `group-timeout` for more information.

View File

@@ -63,4 +63,11 @@ See <<amqp-content-type>> for more information.
A confusing `max-rows-per-poll` property on the JDBC Inbound Channel Adapter and JDBC Outbound Gateway has been deprecated in favor newly introduced `max-rows` property.
See <<jdbc>> for more information.
See <<jdbc>> for more information.
==== Aggregator Changes
An aggregator now expires the group immediately, if the `groupTimeout` is evaluated to a negative value.
Only `null` is considered as a signal do nothing for the current message.
See <<aggregator>> for more information.