You would need to create a custom MDC unit of work. You may be able to extend the existing MDCUnitOfWork from camel-core. And then there is a UnitOfWorkFactory you need to create and setup which creates your custom one.
And yes you need to cleanup stuff with thread context switches and whatnot, see how the existing does that, and you can do similar thing. On Thu, Dec 15, 2016 at 6:50 PM, Oliver Wulff <owu...@talend.com> wrote: > Hi there > > > Camel has already support for MDC logging. I also saw some discussion about > adding static(!) MDC values when the context starts. I'd like to enhance it > and add some application specific context information to every new exchange > like. First I parse the message and set some headers but would also like to > add the header to the MDC like: > > > MDC.put("AppMsgId", headers.get("AppMsgId")) > > > Is there some out-of-the-box support or do I have to create a custom bean to > handle that? > > > Is there anything I have to consider like cleaning the MDC's finally or will > Camel handle that? > > > Thanks a lot for your feedback > > Oli -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2