If a thread switch occurs the MDC context is lost.
You can attach it to the exchange:
public static final AttachmentKey<Map<String, String>> MDC_CONTEXT_KEY = AttachmentKey.create(Map.class);
....
exchange.putAttachment(MDC_CONTEXT_KEY, MDC.getCopyOfContextMap());
...
and then restore it in your worker thread:
MDC.setContextMap(exchange.getAttachment(MDC_CONTEXT_KEY));
Hope this helps,
Andrea Di Cesare
MongoDB Technology Partner
Via Copernico 38, 20125 Milano (Italy)
Mobile: +39 329 737 6417
Skype: ujibang
The company behind
RESTHeart, the NoCoding and NoSQL Platform for MongoDB