With our complex IntegrationFlow that switches between Reactive and Imperative processing, we are seeing a behavior where the ObservationContext (traceId) is changed right after WebFlux.outboundGateway
call.
We followed the documentation and are able to see the reactorContext available via IntegrationMessageHeaderAccessor.REACTOR_CONTEXT
message header, however unable to restore this to ThreadLocal for Imperative processing.
Please suggest what to be done at the below sample for restoring the ObservationContext from Reactor to Imperative.
IntegrationFlow.from(someChannel())
.handle(WebFlux.outboundGateway(m -> url, webClient)
.httpMethod(POST)
.expectedResponseType(String.class),
ec -> ec.customizeMonoReply((message, mono) -> mono.contextCapture()))
// what should be done to restore same reactorContext to imperative
.log(DEBUG, m -> "Imperative Processing starts, as well traceId is changed here :(")
.......
.get();