I am using MDC Logger, which works correctly everywhere apart from when I'm sending a request using HttpClient async. The MDC data is not getting passed to next thread and which means they are not on ours logs. How am I able to get the new thread to have the MDC headers?
java.net.http.HttpClient.newHttpClient()
.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApply(restLogging::logResponse)
.thenApply(response -> handleResponse(url, responseTypeClass, objectMapper, response));