Using the below property, I was able to propogate the ThreadContext to bulkhead pool.
resilience4j.thread-pool-bulkhead.instances.service.context-propagators[0]=com.config.MDCContextPropogater
But it seems that the fallback is executing on a different thread pool named: [pool-4-thread-1]
and MDC or [TraceId,SpanId] is not propogating to it.
Is there a way to resolve this ?
@Override
@Bulkhead(name = service, type = Type.THREADPOOL, fallbackMethod = fallbackService)
@TimeLimiter(name = service, fallbackMethod = fallbackService)
@CircuitBreaker(name = service, fallbackMethod = fallbackService)
public CompletableFuture<String> service(String request) {
return CompletableFuture.completedFuture(process(request));
}
private String process(String request) {
// [bulkhead-service-1] - thread pool - traceId, SpanId is present here
}
public CompletableFuture<String> fallbackService(String request, Exception e) {
// [pool-4-thread-1] - thread pool - traceId, SpanId is not present here, as MDC context is not getting loaded here
}
Is the fallback pool a fork-join-common-pool used by reslience 4j? If yes how to propogate MDC to it's threads.