You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think, i know what the problem is. You are the subscriber now and you have lost the original subscriber context with the traceId, so you need to take over the original subscriber context eg.:
//123
System.out.println(Thread.currentThread().getId() + ":" + MDC.get("traceId"));
return Mono.subscriberContext()
.doOnNext(context -> Mono.just(1).subscriberContext(context) // here the take over
.map(s -> {
thread1(); // and it works here
return 1;
}).doOnNext(integer -> {
System.out.println(Thread.currentThread().getId() + ":" + MDC.get(CORRELATION_ID_KEY)); // and here!
})
.subscribeOn(SETTLEMENT_SCHEDULER)
.subscribe())
.thenMany(
Flux.just(1).map(s -> {
thread2();
return 1;
}).subscribeOn(SETTLEMENT_SCHEDULER));
Can't get value in different streams
eg:
Setting parameters using webfilter
The text was updated successfully, but these errors were encountered: