GH-2302: Clarify in Docs the DSL log() behavior

Fixes: spring-projects/spring-integration/issues/2302
This commit is contained in:
Artem Bilan
2017-12-14 16:33:50 -05:00
committed by Gary Russell
parent 74486a7fde
commit 75b5948c47

View File

@@ -1,7 +1,7 @@
[[java-dsl]]
== Java DSL
The Spring Integration JavaConfig and DSL extension provides a set of convenient Builders and a fluent API to configure Spring Integration message flows from Spring `@Configuration` classes.
The Spring Integration JavaConfig and DSL provides a set of convenient Builders and a fluent API to configure Spring Integration message flows from Spring `@Configuration` classes.
[[java-dsl-example]]
=== Example Configurations
@@ -491,10 +491,43 @@ public IntegrationFlow loggingFlow() {
}
----
[IMPORTANT]
====
The `log()` or `wireTap()` opearators are applied to the current `MessageChannel` (if it is an instance of `ChannelInterceptorAware`) or an intermediate `DirectChannel` is injected into the flow for the currently configured endpoint.
In the example above the `WireTap` interceptor is added to the `myChannel` directly, because `QueueChannel` implements `ChannelInterceptorAware`:
====
[source,java]
----
@Bean
MessageChannel myChannel() {
return new DirectChannel();
}
...
.channel(myChannel())
.log()
}
----
When current `MessageChannel` doesn't implement `ChannelInterceptorAware`, an implicit `DirectChannel` and `BridgeHandler` are injected into the `IntegrationFlow` and the `WireTap` is added to this new `DirectChannel`.
And when there is not any channel declaration like in this sample:
[source,java]
----
.handle(...)
.log()
}
----
an implicit `DirectChannel` is injected in the current position of the `IntegrationFlow` and it is used as an output channel for the currently configured `ServiceActivatingHandler` (the `.handle()` above).
[IMPORTANT]
=====
If `log()` or `wireTap()` are used in the end of flow they are considered as one-way `MessageHandler` s.
If the integration flow is expected to return reply, the `bridge()` should be used in the end, after `log()` or `wireTap()`:
If `log()` or `wireTap()` are used in the end of flow they are considered one-way `MessageHandler` s.
If the integration flow is expected to return a reply, a `bridge()` should be added to the end, after `log()` or `wireTap()`:
=====
[source,java]
----
@Bean
@@ -509,7 +542,6 @@ public IntegrationFlow sseFlow() {
.get();
}
----
=====
[[java-dsl-flows]]
=== Working With Message Flows