[ 
https://issues.apache.org/jira/browse/CAMEL-17514?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-17514.
---------------------------------
    Fix Version/s: 3.14.1
                       (was: 3.14.2)
       Resolution: Fixed

> BreadcrumbId MDC Value not set even MDCLogging is true during ErrorHandling 
> Processor
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-17514
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17514
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 3.13.0, 3.14.0
>            Reporter: Michael Rambichler
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.14.1, 3.15.0
>
>
> *Expected Behaviour:*
> If UseMDCLogging=true and UseBreadcrumb=true is set then i expect then 
> everywhere the MDC Value camel.breadcrumbId is set.
> like it works in Camel Version < 3.12
> *Reproducable* 
> *Camel Version > 3.11*
>  
> Hint: If I use a custom UnitOfWorkFactory it works as expected. But I would 
> assume that If MDCLogging is enabled then the DefaultUnitOfWork would handle 
> this.
>  
> *Log without MDC camel.Breadcrumb:*
> 2022-01-19 12:01:00,335 INFO  [1 - timer://foo] route1                        
>            [route1 0141fbc5-bb47-4458-a982-1e6585109b8a] - Received exchange 
> with breadcrumbID: 0141fbc5-bb47-4458-a982-1e6585109b8a
> 2022-01-19 12:01:00,337 INFO  [1 - timer://foo] 
> c.t.a.r.h.HelloBreadcrumbRoute           [route1 
> 0141fbc5-bb47-4458-a982-1e6585109b8a] - Process with bug
> 2022-01-19 12:01:00,338 INFO  [1 - timer://foo] 
> c.t.a.r.h.OnExceptionProcessor           
> [{color:#FF0000}****breadcrumbMissing****{color}] - Some OnException process
> 2022-01-19 12:01:00,344 INFO  [1 - timer://foo] route2                        
>            [route2 {color:#FF0000}****breadcrumbMissing****{color}] - 
> Deadletter receive
>  
> *Example:*
> @Override
> public void configure() throws Exception {
>    getContext().setUseMDCLogging(true);
>    getContext().setUseBreadcrumb(true);
>    DeadLetterChannelBuilder errorHandlerBuilder = new 
> DeadLetterChannelBuilder();
>    errorHandlerBuilder.setDeadLetterUri("direct:deadletterTest");
>    errorHandlerBuilder.setOnExceptionOccurred(onExceptionProcessor);
>    errorHandler(errorHandlerBuilder);
>    from("timer://foo?fixedRate=true&period=10000")
>       .log("Received exchange with breadcrumbID: ${in.headers.breadcrumbId}")
>       .process(exchange -> {
>           throw new Exception("Some Bug");
>       });
>    from("direct:deadletterTest")
>       .log("Deadletter received ${body}");
>    }
>  
> *OnExceptionProcessor:*
> @Component
> public class OnExceptionProcessor implements Processor {
>    private static final Logger LOG = 
> LoggerFactory.getLogger(OnExceptionProcessor.class);
>    @Override
>    public void process(Exchange exchange) throws Exception {
>       LOG.info("Some OnException process");
>    }
> }
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to