camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Custom MDC property per exchange
Date Thu, 15 Dec 2016 19:13:45 GMT
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 <> 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
> Thanks a lot for your feedback
> Oli

Claus Ibsen
----------------- @davsclaus
Camel in Action 2:

View raw message