@Metadata(label="error") public class OnExceptionDefinition extends ProcessorDefinition<OnExceptionDefinition>
inheritErrorHandler, log
Constructor and Description |
---|
OnExceptionDefinition() |
OnExceptionDefinition(Class<? extends Throwable> exceptionType) |
OnExceptionDefinition(List<Class<? extends Throwable>> exceptionClasses) |
Modifier and Type | Method and Description |
---|---|
void |
addRoutes(RouteContext routeContext,
Collection<Route> routes) |
OnExceptionDefinition |
asyncDelayedRedelivery()
Allow synchronous delayed redelivery.
|
OnExceptionDefinition |
backOffMultiplier(double backOffMultiplier)
Sets the back off multiplier
|
OnExceptionDefinition |
backOffMultiplier(String backOffMultiplier)
Sets the back off multiplier (supports property placeholders)
|
OnExceptionDefinition |
collisionAvoidanceFactor(double collisionAvoidanceFactor)
Sets the collision avoidance factor
|
OnExceptionDefinition |
collisionAvoidanceFactor(String collisionAvoidanceFactor)
Sets the collision avoidance factor (supports property placeholders)
|
OnExceptionDefinition |
collisionAvoidancePercent(double collisionAvoidancePercent)
Sets the collision avoidance percentage
|
OnExceptionDefinition |
continued(boolean continued)
Sets whether the exchange should handle and continue routing from the point of failure.
|
OnExceptionDefinition |
continued(Expression continued)
Sets whether the exchange should be marked as handled or not.
|
OnExceptionDefinition |
continued(Predicate continued)
Sets whether the exchange should be marked as handled or not.
|
protected List<Class<? extends Throwable>> |
createExceptionClasses(ClassResolver resolver) |
CatchProcessor |
createProcessor(RouteContext routeContext)
Override this in definition class and implement logic to create the processor
based on the definition model.
|
RedeliveryPolicy |
createRedeliveryPolicy(CamelContext context,
RedeliveryPolicy parentPolicy)
Allows an exception handler to create a new redelivery policy for this exception type
|
OnExceptionDefinition |
delayPattern(String delayPattern)
Sets the delay pattern with delay intervals.
|
protected String |
description() |
ExpressionSubElementDefinition |
getContinued() |
Predicate |
getContinuedPolicy() |
Processor |
getErrorHandler(String routeId) |
Collection<Processor> |
getErrorHandlers() |
List<Class<? extends Throwable>> |
getExceptionClasses() |
List<String> |
getExceptions() |
ExpressionSubElementDefinition |
getHandled() |
Predicate |
getHandledPolicy() |
String |
getLabel()
Returns a label to describe this node such as the expression if some kind of expression node
|
String |
getOnExceptionbOccurredRef() |
Processor |
getOnExceptionOccurred() |
Processor |
getOnRedelivery() |
String |
getOnRedeliveryRef() |
WhenDefinition |
getOnWhen() |
protected RedeliveryPolicyDefinition |
getOrCreateRedeliveryPolicy() |
List<ProcessorDefinition<?>> |
getOutputs() |
RedeliveryPolicyDefinition |
getRedeliveryPolicy() |
String |
getRedeliveryPolicyRef() |
RedeliveryPolicyDefinition |
getRedeliveryPolicyType() |
ExpressionSubElementDefinition |
getRetryWhile() |
Predicate |
getRetryWhilePolicy() |
Boolean |
getUseOriginalMessagePolicy() |
OnExceptionDefinition |
handled(boolean handled)
Sets whether the exchange should be marked as handled or not.
|
OnExceptionDefinition |
handled(Expression handled)
Sets whether the exchange should be marked as handled or not.
|
OnExceptionDefinition |
handled(Predicate handled)
Sets whether the exchange should be marked as handled or not.
|
boolean |
isAbstract()
Whether this model is abstract or not.
|
protected boolean |
isAsyncDelayedRedelivery(CamelContext context) |
boolean |
isOutputSupported() |
boolean |
isRouteScoped() |
boolean |
isTopLevelOnly()
Whether this definition can only be added as top-level directly on the route itself (such as onException,onCompletion,intercept, etc.)
If trying to add a top-level only definition to a nested output would fail in the
ProcessorDefinition.addOutput(ProcessorDefinition)
method. |
OnExceptionDefinition |
logContinued(boolean logContinued)
Sets whether to log errors even if its continued
|
OnExceptionDefinition |
logContinued(String logContinued)
Sets whether to log errors even if its continued (supports property placeholders)
|
OnExceptionDefinition |
logExhausted(boolean logExhausted)
Sets whether to log exhausted exceptions
|
OnExceptionDefinition |
logExhausted(String logExhausted)
Sets whether to log exhausted exceptions (supports property placeholders)
|
OnExceptionDefinition |
logExhaustedMessageBody(boolean logExhaustedMessageBody)
Sets whether to log exhausted message body with message history.
|
OnExceptionDefinition |
logExhaustedMessageBody(String logExhaustedMessageBody)
Sets whether to log exhausted message body with message history.
|
OnExceptionDefinition |
logExhaustedMessageHistory(boolean logExhaustedMessageHistory)
Sets whether to log exhausted exceptions with message history
|
OnExceptionDefinition |
logExhaustedMessageHistory(String logExhaustedMessageHistory)
Sets whether to log exhausted exceptions with message history
|
OnExceptionDefinition |
logHandled(boolean logHandled)
Sets whether to log errors even if its handled
|
OnExceptionDefinition |
logHandled(String logHandled)
Sets whether to log errors even if its handled (supports property placeholders)
|
OnExceptionDefinition |
logNewException(boolean logNewException)
Sets whether new exceptions should be logged or not (supports property placeholders).
|
OnExceptionDefinition |
logNewException(String logNewException)
Sets whether new exceptions should be logged or not (supports property placeholders).
|
OnExceptionDefinition |
logRetryAttempted(boolean logRetryAttempted)
Sets whether to log retry attempts
|
OnExceptionDefinition |
logRetryAttempted(String logRetryAttempted)
Sets whether to log retry attempts (supports property placeholders)
|
OnExceptionDefinition |
logRetryStackTrace(boolean logRetryStackTrace)
Sets whether to log stacktrace for failed redelivery attempts
|
OnExceptionDefinition |
logRetryStackTrace(String logRetryStackTrace)
Sets whether to log stacktrace for failed redelivery attempts (supports property placeholders)
|
OnExceptionDefinition |
logStackTrace(boolean logStackTrace)
Sets whether to log stacktrace for failed messages.
|
OnExceptionDefinition |
logStackTrace(String logStackTrace)
Sets whether to log stacktrace for failed messages (supports property placeholders)
|
OnExceptionDefinition |
maximumRedeliveries(int maximumRedeliveries)
Sets the maximum redeliveries
5 = default value
0 = no redeliveries
-1 = redeliver forever
|
OnExceptionDefinition |
maximumRedeliveries(String maximumRedeliveries)
Sets the maximum redeliveries (supports property placeholders)
5 = default value
0 = no redeliveries
-1 = redeliver forever
|
OnExceptionDefinition |
maximumRedeliveryDelay(long maximumRedeliveryDelay)
Sets the maximum delay between redelivery
|
OnExceptionDefinition |
maximumRedeliveryDelay(String maximumRedeliveryDelay)
Sets the maximum delay between redelivery (supports property placeholders)
|
OnExceptionDefinition |
onException(Class<? extends Throwable> exceptionType)
Exception clause
for catching certain exceptions and handling them.
|
OnExceptionDefinition |
onExceptionOccurred(Processor processor)
Sets a processor that should be processed just after an exception occurred.
|
OnExceptionDefinition |
onExceptionOccurredRef(String ref)
Sets a reference to a processor that should be processed just after an exception occurred.
|
OnExceptionDefinition |
onRedelivery(Processor processor)
Sets a processor that should be processed before a redelivery attempt.
|
OnExceptionDefinition |
onRedeliveryRef(String ref)
Sets a reference to a processor that should be processed before a redelivery attempt.
|
OnExceptionDefinition |
onWhen(Predicate predicate)
Sets an additional predicate that should be true before the onException is triggered.
|
OnExceptionDefinition |
redeliverDelay(long delay)
Deprecated.
will be removed in the near future. Instead use
redeliveryDelay(String) |
OnExceptionDefinition |
redeliveryDelay(long delay)
Sets the initial redelivery delay
|
OnExceptionDefinition |
redeliveryDelay(String delay)
Sets the initial redelivery delay (supports property placeholders)
|
OnExceptionDefinition |
redeliveryPolicy(RedeliveryPolicy redeliveryPolicy)
Set the
RedeliveryPolicy to be used. |
OnExceptionDefinition |
redeliveryPolicyRef(String redeliveryPolicyRef)
Sets a reference to a
RedeliveryPolicy to lookup in the Registry to be used. |
OnExceptionDefinition |
retriesExhaustedLogLevel(LoggingLevel retriesExhaustedLogLevel)
Sets the logging level to use when retries has exhausted
|
OnExceptionDefinition |
retryAttemptedLogLevel(LoggingLevel retryAttemptedLogLevel)
Sets the logging level to use for logging retry attempts
|
OnExceptionDefinition |
retryWhile(Predicate retryWhile)
Sets the retry while predicate.
|
void |
setContinued(ExpressionSubElementDefinition continued) |
void |
setContinuedPolicy(Predicate continuedPolicy) |
void |
setExceptionClasses(List<Class<? extends Throwable>> exceptionClasses) |
void |
setExceptions(List<String> exceptions)
A set of exceptions to react upon.
|
void |
setHandled(ExpressionSubElementDefinition handled) |
void |
setHandledPolicy(Predicate handledPolicy) |
void |
setOnExceptionbOccurredRef(String onExceptionbOccurredRef) |
void |
setOnExceptionOccurred(Processor onExceptionOccurred) |
void |
setOnRedelivery(Processor onRedelivery) |
void |
setOnRedeliveryRef(String onRedeliveryRef) |
void |
setOnWhen(WhenDefinition onWhen) |
void |
setOutputs(List<ProcessorDefinition<?>> outputs) |
void |
setRedeliveryPolicy(RedeliveryPolicyDefinition redeliveryPolicy) |
void |
setRedeliveryPolicyRef(String redeliveryPolicyRef) |
void |
setRedeliveryPolicyType(RedeliveryPolicyDefinition redeliveryPolicyType) |
void |
setRetryWhile(ExpressionSubElementDefinition retryWhile) |
void |
setRetryWhilePolicy(Predicate retryWhilePolicy) |
void |
setRouteScoped(boolean routeScoped) |
void |
setUseOriginalMessagePolicy(Boolean useOriginalMessagePolicy) |
String |
toString() |
OnExceptionDefinition |
useCollisionAvoidance()
Turn on collision avoidance.
|
OnExceptionDefinition |
useExponentialBackOff()
Turn on exponential backk off
|
OnExceptionDefinition |
useOriginalBody()
Deprecated.
this method will be removed in Camel 3.0, please use
useOriginalMessage() |
OnExceptionDefinition |
useOriginalMessage()
Will use the original input message when an
Exchange is moved to the dead letter queue. |
protected void |
validateConfiguration() |
addInterceptStrategies, addInterceptStrategy, addOutput, aggregate, aggregate, aggregate, aggregate, aop, attribute, bean, bean, bean, bean, bean, bean, bean, bean, beanRef, beanRef, beanRef, beanRef, beanRef, choice, clearOutput, configureChild, convertBodyTo, convertBodyTo, createChannel, createChildProcessor, createCompositeProcessor, createOutputsProcessor, createOutputsProcessor, createOutputsProcessorImpl, createProcessor, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endDoTry, endParent, endRest, enrich, enrich, enrich, enrich, enrich, enrichRef, enrichRef, enrichRef, filter, filter, filter, filter, getIndex, getInterceptStrategies, getOtherAttributes, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, inOut, isInheritErrorHandler, loadBalance, loadBalance, log, log, log, log, log, log, loop, loop, loop, loopDoWhile, makeProcessor, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, pipeline, pipeline, pipeline, pipeline, placeholder, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichRef, pollEnrichRef, preCreateProcessor, process, process, processRef, recipientList, recipientList, recipientList, recipientList, removeFaultHeader, removeHeader, removeHeaders, removeHeaders, removeProperties, removeProperties, removeProperty, resequence, resequence, rollback, rollback, routeDescription, routeId, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, sample, sample, sample, script, script, setBody, setBody, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setInheritErrorHandler, setOtherAttributes, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sort, split, split, split, startupOrder, stop, threads, threads, threads, threads, throttle, throttle, throwException, throwException, to, to, to, to, to, to, to, to, to, to, toD, toD, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wrapChannel, wrapInErrorHandler, wrapProcessor
description, description, getCustomId, getDescription, getDescriptionText, getId, getShortName, hasCustomIdAssigned, idOrCreate, setCustomId, setDescription, setId
public OnExceptionDefinition()
public OnExceptionDefinition(List<Class<? extends Throwable>> exceptionClasses)
public void setRouteScoped(boolean routeScoped)
public boolean isRouteScoped()
protected String description()
public String getLabel()
ProcessorDefinition
getLabel
in interface NamedNode
getLabel
in class ProcessorDefinition<OnExceptionDefinition>
public boolean isAbstract()
ProcessorDefinition
isAbstract
in class ProcessorDefinition<OnExceptionDefinition>
public boolean isTopLevelOnly()
ProcessorDefinition
ProcessorDefinition.addOutput(ProcessorDefinition)
method.isTopLevelOnly
in class ProcessorDefinition<OnExceptionDefinition>
public RedeliveryPolicy createRedeliveryPolicy(CamelContext context, RedeliveryPolicy parentPolicy)
context
- the camel contextparentPolicy
- the current redelivery policy, is newer nullpublic void addRoutes(RouteContext routeContext, Collection<Route> routes) throws Exception
addRoutes
in class ProcessorDefinition<OnExceptionDefinition>
Exception
public CatchProcessor createProcessor(RouteContext routeContext) throws Exception
ProcessorDefinition
createProcessor
in class ProcessorDefinition<OnExceptionDefinition>
Exception
protected void validateConfiguration()
public OnExceptionDefinition onException(Class<? extends Throwable> exceptionType)
ProcessorDefinition
onException
in class ProcessorDefinition<OnExceptionDefinition>
exceptionType
- the exception to catchpublic OnExceptionDefinition handled(boolean handled)
handled
- handled or notpublic OnExceptionDefinition handled(Predicate handled)
handled
- predicate that determines true or falsepublic OnExceptionDefinition handled(Expression handled)
handled
- expression that determines true or falsepublic OnExceptionDefinition continued(boolean continued)
continued
- continued or notpublic OnExceptionDefinition continued(Predicate continued)
continued
- predicate that determines true or falsepublic OnExceptionDefinition continued(Expression continued)
continued
- expression that determines true or falsepublic OnExceptionDefinition onWhen(Predicate predicate)
predicate
- predicate that determines true or falsepublic OnExceptionDefinition retryWhile(Predicate retryWhile)
retryWhile
- predicate that determines when to stop retrying@Deprecated public OnExceptionDefinition redeliverDelay(long delay)
redeliveryDelay(String)
delay
- the initial redelivery delaypublic OnExceptionDefinition backOffMultiplier(double backOffMultiplier)
backOffMultiplier
- the back off multiplierpublic OnExceptionDefinition backOffMultiplier(String backOffMultiplier)
backOffMultiplier
- the back off multiplierpublic OnExceptionDefinition collisionAvoidanceFactor(double collisionAvoidanceFactor)
collisionAvoidanceFactor
- the factorpublic OnExceptionDefinition collisionAvoidanceFactor(String collisionAvoidanceFactor)
collisionAvoidanceFactor
- the factorpublic OnExceptionDefinition collisionAvoidancePercent(double collisionAvoidancePercent)
collisionAvoidancePercent
- the percentagepublic OnExceptionDefinition redeliveryDelay(long delay)
delay
- delay in millispublic OnExceptionDefinition redeliveryDelay(String delay)
delay
- delay in millispublic OnExceptionDefinition asyncDelayedRedelivery()
RedeliveryPolicy.setAsyncDelayedRedelivery(boolean)
public OnExceptionDefinition retriesExhaustedLogLevel(LoggingLevel retriesExhaustedLogLevel)
retriesExhaustedLogLevel
- the logging levelpublic OnExceptionDefinition retryAttemptedLogLevel(LoggingLevel retryAttemptedLogLevel)
retryAttemptedLogLevel
- the logging levelpublic OnExceptionDefinition logStackTrace(boolean logStackTrace)
public OnExceptionDefinition logStackTrace(String logStackTrace)
public OnExceptionDefinition logRetryStackTrace(boolean logRetryStackTrace)
public OnExceptionDefinition logRetryStackTrace(String logRetryStackTrace)
public OnExceptionDefinition logHandled(boolean logHandled)
public OnExceptionDefinition logHandled(String logHandled)
public OnExceptionDefinition logNewException(boolean logNewException)
public OnExceptionDefinition logNewException(String logNewException)
public OnExceptionDefinition logContinued(boolean logContinued)
public OnExceptionDefinition logContinued(String logContinued)
public OnExceptionDefinition logRetryAttempted(boolean logRetryAttempted)
public OnExceptionDefinition logRetryAttempted(String logRetryAttempted)
public OnExceptionDefinition logExhausted(boolean logExhausted)
public OnExceptionDefinition logExhausted(String logExhausted)
public OnExceptionDefinition logExhaustedMessageHistory(boolean logExhaustedMessageHistory)
public OnExceptionDefinition logExhaustedMessageHistory(String logExhaustedMessageHistory)
public OnExceptionDefinition logExhaustedMessageBody(boolean logExhaustedMessageBody)
public OnExceptionDefinition logExhaustedMessageBody(String logExhaustedMessageBody)
public OnExceptionDefinition maximumRedeliveries(int maximumRedeliveries)
maximumRedeliveries
- the valuepublic OnExceptionDefinition maximumRedeliveries(String maximumRedeliveries)
maximumRedeliveries
- the valuepublic OnExceptionDefinition useCollisionAvoidance()
public OnExceptionDefinition useExponentialBackOff()
public OnExceptionDefinition maximumRedeliveryDelay(long maximumRedeliveryDelay)
maximumRedeliveryDelay
- the delay in millispublic OnExceptionDefinition maximumRedeliveryDelay(String maximumRedeliveryDelay)
maximumRedeliveryDelay
- the delay in millispublic OnExceptionDefinition redeliveryPolicy(RedeliveryPolicy redeliveryPolicy)
RedeliveryPolicy
to be used.redeliveryPolicy
- the redelivery policypublic OnExceptionDefinition redeliveryPolicyRef(String redeliveryPolicyRef)
RedeliveryPolicy
to lookup in the Registry
to be used.redeliveryPolicyRef
- reference to use for lookuppublic OnExceptionDefinition delayPattern(String delayPattern)
delayPattern
- the delay pattern@Deprecated public OnExceptionDefinition useOriginalBody()
useOriginalMessage()
useOriginalMessage()
public OnExceptionDefinition useOriginalMessage()
Exchange
is moved to the dead letter queue.
Notice: this only applies when all redeliveries attempt have failed and the Exchange
is doomed for failure.
Exchange
IN body we use the original IN body instead. This allows
you to store the original input in the dead letter queue instead of the inprogress snapshot of the IN body.
For instance if you route transform the IN body during routing and then failed. With the original exchange
store in the dead letter queue it might be easier to manually re submit the Exchange
again as the IN body
is the same as when Camel received it. So you should be able to send the Exchange
to the same input.
By default this feature is off.public OnExceptionDefinition onRedelivery(Processor processor)
Exchange
before its being redelivered.public OnExceptionDefinition onRedeliveryRef(String ref)
Exchange
before its being redelivered.ref
- reference to the processorpublic OnExceptionDefinition onExceptionOccurred(Processor processor)
public OnExceptionDefinition onExceptionOccurredRef(String ref)
ref
- reference to the processorpublic List<ProcessorDefinition<?>> getOutputs()
getOutputs
in class ProcessorDefinition<OnExceptionDefinition>
public void setOutputs(List<ProcessorDefinition<?>> outputs)
public boolean isOutputSupported()
isOutputSupported
in class ProcessorDefinition<OnExceptionDefinition>
public void setExceptionClasses(List<Class<? extends Throwable>> exceptionClasses)
public Collection<Processor> getErrorHandlers()
public RedeliveryPolicyDefinition getRedeliveryPolicy()
public void setRedeliveryPolicy(RedeliveryPolicyDefinition redeliveryPolicy)
public RedeliveryPolicyDefinition getRedeliveryPolicyType()
public void setRedeliveryPolicyType(RedeliveryPolicyDefinition redeliveryPolicyType)
public String getRedeliveryPolicyRef()
public void setRedeliveryPolicyRef(String redeliveryPolicyRef)
public Predicate getHandledPolicy()
public void setHandled(ExpressionSubElementDefinition handled)
public ExpressionSubElementDefinition getContinued()
public void setContinued(ExpressionSubElementDefinition continued)
public ExpressionSubElementDefinition getHandled()
public void setHandledPolicy(Predicate handledPolicy)
public Predicate getContinuedPolicy()
public void setContinuedPolicy(Predicate continuedPolicy)
public WhenDefinition getOnWhen()
public void setOnWhen(WhenDefinition onWhen)
public ExpressionSubElementDefinition getRetryWhile()
public void setRetryWhile(ExpressionSubElementDefinition retryWhile)
public Predicate getRetryWhilePolicy()
public void setRetryWhilePolicy(Predicate retryWhilePolicy)
public Processor getOnRedelivery()
public void setOnRedelivery(Processor onRedelivery)
public String getOnRedeliveryRef()
public void setOnRedeliveryRef(String onRedeliveryRef)
public Processor getOnExceptionOccurred()
public void setOnExceptionOccurred(Processor onExceptionOccurred)
public String getOnExceptionbOccurredRef()
public void setOnExceptionbOccurredRef(String onExceptionbOccurredRef)
public Boolean getUseOriginalMessagePolicy()
public void setUseOriginalMessagePolicy(Boolean useOriginalMessagePolicy)
protected boolean isAsyncDelayedRedelivery(CamelContext context)
protected RedeliveryPolicyDefinition getOrCreateRedeliveryPolicy()
protected List<Class<? extends Throwable>> createExceptionClasses(ClassResolver resolver) throws ClassNotFoundException
ClassNotFoundException
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.