GH-3946: Revise Router channelKeyFallback option (#3948)
* GH-3946: Revise Router channelKeyFallback option Fixes https://github.com/spring-projects/spring-integration/issues/3946 The `AbstractMappingMessageRouter` has both `resolutionRequired` and `channelKeyFallback` as `true` by default. End-users expects them to back off when they set a `defaultOutputChannel`. They really want something similar to Java `switch` statement * Change the logic in the `AbstractMappingMessageRouter` to reset `channelKeyFallback` to `false` when `defaultOutputChannel` to avoid attempts to resolve channel from name, but rather fallback to `defaultOutputChannel` as it states from th mentioned Java `switch` statement experience * Deprecate `RouterSpec.noChannelKeyFallback()` in favor of newly introduced `channelKeyFallback(boolean)` * Call `channelKeyFallback(false)` from an overloaded `defaultOutputToParentFlow()` to reflect the mentioned expected behavior in Java DSL as well. * Respectively, deprecate `KotlinRouterSpec.noChannelKeyFallback()` wrapper in favor of newly introduced `channelKeyFallback(channelKeyFallback: Boolean)` * Remove redundant already `noChannelKeyFallback()` option in the `NoFallbackAllowedTests` * Document the change and new behavior * Fix `IntegrationGraphServerTests` to `setChannelKeyFallback(true)` explicitly * Remove not relevant `default-output-channel` from the `DynamicRouterTests-context.xml` * Reject an `AbstractMappingMessageRouter` configuration where `defaultOutputChannel` is provided and both `channelKeyFallback` & `resolutionRequired` are set to `true`. Such a state makes `defaultOutputChannel` as not reachable and may cause some confusions in target applications. * Remove `&` symbol from JavaDocs * Fix `boolean` expression for `AbstractMappingMessageRouter` configuration check * Fix `IntegrationGraphServerTests` for new router behavior * Improve language in docs
This commit is contained in:
@@ -19,8 +19,7 @@
|
||||
object-name="org.springframework.integration.jmx.config:type=SimpleDynamicRouter,name=dynamicRouter"
|
||||
operation-name="addChannelMapping" />
|
||||
|
||||
<int:router input-channel="routingChannel" ref="dynamicRouter" method="route"
|
||||
default-output-channel="errorChannel"/>
|
||||
<int:router input-channel="routingChannel" ref="dynamicRouter" method="route"/>
|
||||
|
||||
<bean id="dynamicRouter"
|
||||
class="org.springframework.integration.jmx.config.SimpleDynamicRouter">
|
||||
|
||||
Reference in New Issue
Block a user