Skip to content

Commit 4e7caed

Browse files
committed
Add comment why and how we handle Mono->CompletableFuture
1 parent 1cea029 commit 4e7caed

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,14 @@ private static CompletableFuture<?> toFutureReply(Object reply, @Nullable Reacti
384384

385385
reactiveReply
386386
.publishOn(Schedulers.boundedElastic())
387-
// TODO until Reactor supports context propagation from the MonoToCompletableFuture
387+
/*
388+
The MonoToCompletableFuture in Project Reactor does not support context propagation,
389+
and it does not suppose to, since there is no guarantee how this Future is going to
390+
be handled downstream.
391+
However, in our case we process it directly in this class in the doProduceOutput()
392+
via whenComplete() callback. So, when value is set into the Future, it is available
393+
in the callback in the same thread immediately.
394+
*/
388395
.doOnEach((signal) -> {
389396
try (AutoCloseable scope = IntegrationReactiveUtils
390397
.setThreadLocalsFromReactorContext(signal.getContextView())) {

0 commit comments

Comments
 (0)