-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore ReactorContext into Imperative Processing #9259
Comments
Was going to suggest another workaround:
and
or
But that does not work: the first one just ignores everything else. The second one ends up with a sort in Will raise separate issue and fix. Nothing related for this yet. |
Here is that issue: #9260. BTW, feel free to contribute fixes: https://github.com/spring-projects/spring-integration/blob/main/CONTRIBUTING.adoc |
So, our logic for the reactive reply from this kind of components is like Thinking... |
I have made the fix and now your sample application is OK:
Will issue Pull Request shortly. |
Forgot to mention. |
…eply Fixes: spring-projects#9259 The `Mono.toFuture()` does not propagate context to thread locals of the `CompletableFuture` consumer. See `MonoToCompletableFuture` * Fix `AbstractMessageProducingHandler` to convert reply `Mono` to `CompletableFuture` manually. Use `doOnEach()` and set thread locals from the Reactor context manually around `replyFuture.complete()/completeExceptionally()` * Add respective unit test into `WebFluxObservationPropagationTests` to ensure that same trace is used in downstream endpoints after WebFlux client reply **Auto-cherry-pick to `6.3.x` & `6.2.x`**
Fixes: #9259 The `Mono.toFuture()` does not propagate context to thread locals of the `CompletableFuture` consumer. See `MonoToCompletableFuture` * Fix `AbstractMessageProducingHandler` to convert reply `Mono` to `CompletableFuture` manually. Use `doOnEach()` and set thread locals from the Reactor context manually around `replyFuture.complete()/completeExceptionally()` * Add respective unit test into `WebFluxObservationPropagationTests` to ensure that same trace is used in downstream endpoints after WebFlux client reply (cherry picked from commit 4a77dbc)
Fixes: #9259 The `Mono.toFuture()` does not propagate context to thread locals of the `CompletableFuture` consumer. See `MonoToCompletableFuture` * Fix `AbstractMessageProducingHandler` to convert reply `Mono` to `CompletableFuture` manually. Use `doOnEach()` and set thread locals from the Reactor context manually around `replyFuture.complete()/completeExceptionally()` * Add respective unit test into `WebFluxObservationPropagationTests` to ensure that same trace is used in downstream endpoints after WebFlux client reply (cherry picked from commit 4a77dbc)
Thanks for the quick fix. |
ReactorContext
is NOT carried onto the following Imperative processing and this results in a new ObservationContext (change in traceId)SO reference - https://stackoverflow.com/questions/78653090/spring-integration-restore-reactorcontext-into-imperative-processing
Issue happening with Spring Boot v3.3.0
The text was updated successfully, but these errors were encountered: