use of org.apache.camel.processor.FatalFallbackErrorHandler in project camel by apache.
the class OnExceptionDefinition method addRoutes.
public void addRoutes(RouteContext routeContext, Collection<Route> routes) throws Exception {
// and therefore is in a better position to decide among context/route scoped OnException at runtime
if (routeScoped == null) {
routeScoped = super.getParent() != null;
}
setHandledFromExpressionType(routeContext);
setContinuedFromExpressionType(routeContext);
setRetryWhileFromExpressionType(routeContext);
setOnRedeliveryFromRedeliveryRef(routeContext);
setOnExceptionOccurredFromOnExceptionOccurredRef(routeContext);
// load exception classes
if (exceptions != null && !exceptions.isEmpty()) {
exceptionClasses = createExceptionClasses(routeContext.getCamelContext().getClassResolver());
}
// must validate configuration before creating processor
validateConfiguration();
if (useOriginalMessagePolicy != null && useOriginalMessagePolicy) {
// ensure allow original is turned on
routeContext.setAllowUseOriginalMessage(true);
}
// lets attach this on exception to the route error handler
Processor child = createOutputsProcessor(routeContext);
if (child != null) {
// wrap in our special safe fallback error handler if OnException have child output
Processor errorHandler = new FatalFallbackErrorHandler(child);
String id = routeContext.getRoute().getId();
errorHandlers.put(id, errorHandler);
}
// lookup the error handler builder
ErrorHandlerBuilder builder = (ErrorHandlerBuilder) routeContext.getRoute().getErrorHandlerBuilder();
// and add this as error handlers
builder.addErrorHandlers(routeContext, this);
}
use of org.apache.camel.processor.FatalFallbackErrorHandler in project camel by apache.
the class DeadLetterChannelBuilder method getFailureProcessor.
// Properties
// -------------------------------------------------------------------------
public Processor getFailureProcessor() {
if (failureProcessor == null) {
// wrap in our special safe fallback error handler if sending to dead letter channel fails
Processor child = new SendProcessor(deadLetter, ExchangePattern.InOnly);
// force MEP to be InOnly so when sending to DLQ we would not expect a reply if the MEP was InOut
failureProcessor = new FatalFallbackErrorHandler(child, true);
}
return failureProcessor;
}
Aggregations