org.apache.camel.processor
Class CatchProcessor
java.lang.Object
org.apache.camel.support.ServiceSupport
org.apache.camel.processor.DelegateAsyncProcessor
org.apache.camel.processor.CatchProcessor
- All Implemented Interfaces:
- AsyncProcessor, DelegateProcessor, Navigate<Processor>, Processor, Service, ShutdownableService, StatefulService, SuspendableService, Traceable
public class CatchProcessor
- extends DelegateAsyncProcessor
- implements Traceable
A processor which catches exceptions.
- Version:
Methods inherited from class org.apache.camel.support.ServiceSupport |
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
CatchProcessor
public CatchProcessor(List<Class<? extends Throwable>> exceptions,
Processor processor,
Predicate onWhen,
Predicate handled)
toString
public String toString()
- Overrides:
toString
in class DelegateAsyncProcessor
getTraceLabel
public String getTraceLabel()
- Description copied from interface:
Traceable
- Gets the trace label used for logging when tracing is enabled.
The label should be short and precise.
- Specified by:
getTraceLabel
in interface Traceable
- Returns:
- the label
catches
public Throwable catches(Exchange exchange,
Throwable exception)
- Returns with the exception that is caught by this processor.
This method traverses exception causes, so sometimes the exception
returned from this method might be one of causes of the parameter
passed.
- Parameters:
exchange
- the current exchangeexception
- the thrown exception
- Returns:
- Throwable that this processor catches. null if nothing matches.
handles
public boolean handles(Exchange exchange)
- Whether this catch processor handles the exception it have caught
- Parameters:
exchange
- the current exchange
- Returns:
- true if this processor handles it, false otherwise.
getExceptions
public List<Class<? extends Throwable>> getExceptions()
matchesWhen
protected boolean matchesWhen(Exchange exchange)
- Strategy method for matching the exception type with the current exchange.
This default implementation will match as:
- Always true if no when predicate on the exception type
- Otherwise the when predicate is matches against the current exchange
- Parameters:
exchange
- the current Exchange
- Returns:
- true if matched, false otherwise.
Apache CAMEL