use of org.apache.camel.processor.exceptionpolicy.ExceptionPolicyKey in project camel by apache.
the class ErrorHandlerSupport method addExceptionPolicy.
public void addExceptionPolicy(RouteContext routeContext, OnExceptionDefinition exceptionType) {
if (routeContext != null) {
// add error handler as child service so they get lifecycle handled
Processor errorHandler = exceptionType.getErrorHandler(routeContext.getRoute().getId());
if (errorHandler != null) {
addChildService(errorHandler);
}
}
List<Class<? extends Throwable>> list = exceptionType.getExceptionClasses();
for (Class<? extends Throwable> clazz : list) {
String routeId = null;
// only get the route id, if the exception type is route scoped
if (exceptionType.isRouteScoped()) {
RouteDefinition route = ProcessorDefinitionHelper.getRoute(exceptionType);
if (route != null) {
routeId = route.getId();
}
}
ExceptionPolicyKey key = new ExceptionPolicyKey(routeId, clazz, exceptionType.getOnWhen());
exceptionPolicies.put(key, exceptionType);
}
}
Aggregations