INT-4129: Add Discard Channel to Barrier Handler

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

Discard late arriving triggers.

* Minor code style polishing
This commit is contained in:
Gary Russell
2016-10-06 09:44:19 -04:00
committed by Artem Bilan
parent f9ddefec2c
commit 9e3156ae7d
8 changed files with 111 additions and 55 deletions

View File

@@ -44,6 +44,7 @@ An exception is thrown if a second thread arrives with the same correlation.
<int:barrier id="barrier1" input-channel="in" output-channel="out"
correlation-strategy-expression="headers['myHeader']"
output-processor="myOutputProcessor"
discard-channel="lateTriggerChannel"
timeout="10000">
</int:barrier>
@@ -55,6 +56,7 @@ Either the thread sending a message to `in` or the one sending a message to `rel
up to 10 seconds until the other arrives.
When the message is released, the `out` channel will be sent a message combining the result of invoking the
custom `MessageGroupProcessor` bean `myOutputProcessor`.
If the main thread times out and a trigger arrives later, you can configure a discard channel to which the late trigger will be sent.
Java configuration is shown below.
[source, java]
@@ -68,6 +70,7 @@ public class Config {
public BarrierMessageHandler barrier() {
BarrierMessageHandler barrier = new BarrierMessageHandler(10000);
barrier.setOutputChannel(out());
barrier.setDiscardChannel(lateTriggers());
return barrier;
}

View File

@@ -50,3 +50,8 @@ See <<global-properties>> for more information.
There is a new option on the `CharacterStreamReadingMessageSource` to allow it to be used to "pipe" stdin and publish an application event when the pipe is closed.
See <<stream-reading>> for more information.
==== Barrier Changes
The `BarrierMessageHandler` now supports a discard channel to which late-arriving trigger messages are sent.
See <<barrier>> for more information.