Skip to content

Commit 75b5948

Browse files
artembilangaryrussell
authored andcommitted
GH-2302: Clarify in Docs the DSL log() behavior
Fixes: /issues/2302
1 parent 74486a7 commit 75b5948

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

src/reference/asciidoc/dsl.adoc

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[[java-dsl]]
22
== Java DSL
33

4-
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.
4+
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.
55

66
[[java-dsl-example]]
77
=== Example Configurations
@@ -492,9 +492,42 @@ public IntegrationFlow loggingFlow() {
492492
----
493493

494494
[IMPORTANT]
495+
====
496+
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.
497+
In the example above the `WireTap` interceptor is added to the `myChannel` directly, because `QueueChannel` implements `ChannelInterceptorAware`:
498+
====
499+
500+
[source,java]
501+
----
502+
@Bean
503+
MessageChannel myChannel() {
504+
return new DirectChannel();
505+
}
506+
507+
...
508+
.channel(myChannel())
509+
.log()
510+
}
511+
----
512+
513+
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`.
514+
And when there is not any channel declaration like in this sample:
515+
516+
[source,java]
517+
----
518+
.handle(...)
519+
.log()
520+
}
521+
----
522+
523+
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).
524+
525+
[IMPORTANT]
526+
=====
527+
If `log()` or `wireTap()` are used in the end of flow they are considered one-way `MessageHandler` s.
528+
If the integration flow is expected to return a reply, a `bridge()` should be added to the end, after `log()` or `wireTap()`:
495529
=====
496-
If `log()` or `wireTap()` are used in the end of flow they are considered as one-way `MessageHandler` s.
497-
If the integration flow is expected to return reply, the `bridge()` should be used in the end, after `log()` or `wireTap()`:
530+
498531
[source,java]
499532
----
500533
@Bean
@@ -509,7 +542,6 @@ public IntegrationFlow sseFlow() {
509542
.get();
510543
}
511544
----
512-
=====
513545

514546
[[java-dsl-flows]]
515547
=== Working With Message Flows

0 commit comments

Comments
 (0)