Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-17514

BreadcrumbId MDC Value not set even MDCLogging is true during ErrorHandling Processor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.13.0, 3.14.0
    • 3.14.1, 3.15.0
    • camel-core
    • None
    • Unknown

    Description

      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           [***breadcrumbMissing***] - Some OnException process
      2022-01-19 12:01:00,344 INFO  [1 - timer://foo] route2                                   [route2 ***breadcrumbMissing***] - 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");    }

      }
       
       
       

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              rambichler Michael Rambichler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: