From 1244c6c22acefe5371f788a205bf547ebefb3dd7 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 15 Nov 2017 15:21:14 -0500 Subject: [PATCH] The log() in the end IMPORTANT note in dsl.adoc --- .../dsl/IntegrationFlowDefinition.java | 3 --- src/reference/asciidoc/dsl.adoc | 22 ++++++++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java index 50395b93a3..a0b9c747e1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java @@ -2742,9 +2742,6 @@ public abstract class IntegrationFlowDefinition`), a `log()` operator is presented. Underneath it is represented by the `WireTap` `ChannelInterceptor` and `LoggingHandler` as subscriber. -It is responsible to log message incoming into the next endpoint: +It is responsible to log message incoming into the next endpoint or for the current channel: [source,java] ---- @@ -491,6 +491,26 @@ public IntegrationFlow loggingFlow() { } ---- +[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()`: +[source,java] +---- +@Bean +public IntegrationFlow sseFlow() { + return IntegrationFlows + .from(WebFlux.inboundGateway("/sse") + .requestMapping(m -> + m.produces(MediaType.TEXT_EVENT_STREAM_VALUE))) + .handle((p, h) -> Flux.just("foo", "bar", "baz")) + .log(LoggingHandler.Level.WARN) + .bridge() + .get(); +} +---- +===== + [[java-dsl-flows]] === Working With Message Flows