Michael Rambichler created CAMEL-17514:
------------------------------------------
Summary: 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, camel-spring-boot
Affects Versions: 3.14.0, 3.13.0
Reporter: Michael Rambichler
*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)