GH-8981: Add UnicastingDispatcher.failoverStrategy option

Fixes: #8981

Sometime the simple `boolean failover` on the `MessageChannel` (default `true`)
is not enough to be sure that we can dispatch to the next handler or not.
Such a decision can be made using `ErrorMessageExceptionTypeRouter`, but that would
require an overhaul for the whole integration flow

* Introduce a simple `Predicate<Exception> failoverStrategy` into `UnicastingDispatcher`
and all its `MessageChannel` implementation consumers to allow to make a decision about next failover
according to a thrown exception from the current `MessageHandler`
* Expose `failoverStrategy` on the `DirectChannel`, `ExecutorChannel` & `PartitionedChannel`,
and add it into respective Java DSL specs
* Fix involved tests to rely on the `failoverStrategy` property from now on
* Document the new feature
This commit is contained in:
Artem Bilan
2024-03-12 18:16:02 -04:00
committed by GitHub
parent 676733ccf7
commit ffe3605c90
14 changed files with 230 additions and 130 deletions

View File

@@ -112,6 +112,10 @@ XML::
----
======
Starting with version 6.3, all the `MessageChannel` implementations based on the `UnicastingDispatcher` can be configured with a `Predicate<Exception> failoverStrategy` instead of plain `failover` option.
This predicate makes a decision to failover or not to the next `MessageHandler` based on an exception thrown from the current one.
The more complex error analysis should be done using xref:router/implementations.adoc#router-implementations-exception-router[`ErrorMessageExceptionTypeRouter`].
[[channel-datatype-channel]]
== Datatype Channel Configuration

View File

@@ -23,6 +23,9 @@ The `MessageHistory` header is now mutable, append-only container.
And all the subsequent tracks don't create new message - only their entry is added to existing message history header.
See xref:message-history.adoc[Message History Chapter] for more information.
All the `MessageChannel` implementations based on the `UnicastingDispatcher` now can be configured with a `Predicate<Exception> failoverStrategy` for dynamic decision for the failover on the exception thrown from the current `MessageHandler`.
See xref:channel/configuration.adoc[Message Channel Configuration] for more information.
[[x6.3-security-changes]]
=== Security Support Changes