Skip to content

Commit

Permalink
Add comment why and how we handle Mono->CompletableFuture
Browse files Browse the repository at this point in the history
  • Loading branch information
artembilan committed Jul 3, 2024
1 parent 1cea029 commit 4e7caed
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,14 @@ private static CompletableFuture<?> toFutureReply(Object reply, @Nullable Reacti

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

0 comments on commit 4e7caed

Please sign in to comment.