From 5b43b6c7dd6069e68ce03de72770667bac4c7448 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 21 Aug 2019 10:03:10 -0400 Subject: [PATCH] GH-2890: Document a bridge for subflow starts Fixes https://github.com/spring-projects/spring-integration/issues/2890 Explain in a docs why and how a `bridge` appears in the flow when we declare a subflow for mapping * Upgrade to Kotlin `1.3.50` * Upgrade to Kotlin `1.3.50` * Polishing Doc according PR comments Doc polishing --- build.gradle | 2 +- src/reference/asciidoc/dsl.adoc | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 36674bcac0..79be9f34de 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlinVersion = '1.3.40' + ext.kotlinVersion = '1.3.50' repositories { maven { url 'https://repo.spring.io/plugins-release' } } diff --git a/src/reference/asciidoc/dsl.adoc b/src/reference/asciidoc/dsl.adoc index a5dbd5b300..f4d138f0df 100644 --- a/src/reference/asciidoc/dsl.adoc +++ b/src/reference/asciidoc/dsl.adoc @@ -816,6 +816,24 @@ When you configure a sub-flow as a lambda, the framework handles the request-rep Sub-flows can be nested to any depth, but we do not recommend doing so. In fact, even in the router case, adding complex sub-flows within a flow would quickly begin to look like a plate of spaghetti and be difficult for a human to parse. +[NOTE] +==== +In cases where the DSL supports a subflow configuration, when a channel is normally needed for the component being configured, and that subflow starts with a `channel()` element, the framework implicitly places a `bridge()` between the component output channel and the flow's input channel. +For example, in this `filter` definition: + +[source,java] +---- +.filter(p -> p instanceof String, e -> e + .discardFlow(df -> df + .channel(MessageChannels.queue()) + ...) +---- +the Framework internally creates a `DirectChannel` bean for injecting into the `MessageFilter.discardChannel`. +Then it wraps the subflow into an `IntegrationFlow` starting with this implicit channel for the subscription and places a `bridge` before the `channel()` specified in the flow. +When an existing `IntegrationFlow` bean is used as a subflow reference (instead of an inline subflow, e.g. a lambda), there is no such bridge required because the framework can resolve the first channel from the flow bean. +With an inline subflow, the input channel is not yet available. +==== + [[java-dsl-protocol-adapters]] === Using Protocol Adapters