-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
When using WebClient
in servlet environment, MDC is one of the pain point that requires boilerplate code.
Since RestTemplate
is in maintenance mode, more and more apps would choose to use WebClient
.
It would be very helpful that spring provides out of the box support for MDC for the use of WebClient
. Then, it would be a smooth ride migrating RestTemplate
to WebClient
.
Since spring already detects underlying logging framework, it could be implemented agnostic to the actual logging framework.
What needs to be implemented:
-
Pass MDC values from main thread to reactor thread
In servlet environment, it is required to propagate MDC context values from servlet thread to reactor thread.
To implement,ExchangeFilterFunction
or some sort of hook which should apply as the first action of response operators. -
Pass around MDC values to subscriber context within reactor schedulers/operators
My suggestion to reactor-addons. Add-on to support MDC reactor/reactor-addons#219
If such boilerplate code is provided from spring, then, spring-boot may auto-configure the MDC support.
Relates to reactor/reactor-core#1985