public class DefaultExceptionPolicyStrategy extends Object implements ExceptionPolicyStrategy
OnExceptionDefinitionthat should handle the thrown exception. Selection strategy:
createExceptionIterator(Throwable)provides the Iterator used for the walking.
filter(org.apache.camel.model.OnExceptionDefinition, Class, Throwable)method. By default the filter uses instanceof test.
OnExceptionDefinitionhas a when defined with an expression the type is also matches against the current exchange using the
matchesWhen(org.apache.camel.model.OnExceptionDefinition, org.apache.camel.Exchange)method. This can be used to for more fine grained matching, so you can e.g. define multiple sets of exception types with the same exception class(es) but have a predicate attached to select which to select at runtime.
|Constructor and Description|
|Modifier and Type||Method and Description|
Strategy method creating the iterator to walk the exception in the order Camel should use for find the
Strategy to filter the given type exception class with the thrown exception
Strategy method for matching the exception type with the current exchange.
public OnExceptionDefinition getExceptionPolicy(Map<ExceptionPolicyKey,OnExceptionDefinition> exceptionPolicies, Exchange exchange, Throwable exception)
OnExceptionDefinitionthat should handle the thrown exception.
protected boolean filter(OnExceptionDefinition type, Class<?> exceptionClass, Throwable exception)
type- the exception type
exceptionClass- the current exception class for testing
exception- the thrown exception
protected boolean matchesWhen(OnExceptionDefinition definition, Exchange exchange)
definition- the exception definition
exchange- the current
OnExceptionDefinitionshould be used. The default iterator will walk from the bottom upwards (the last caused by going upwards to the exception)
exception- the exception