@Metadata(label="error") public class OnExceptionDefinition extends OutputDefinition<OnExceptionDefinition>
outputs
inheritErrorHandler, log
Constructor and Description |
---|
OnExceptionDefinition() |
OnExceptionDefinition(Class<? extends Throwable> exceptionType) |
OnExceptionDefinition(List<Class<? extends Throwable>> exceptionClasses) |
Modifier and Type | Method and Description |
---|---|
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(org.apache.camel.Expression continued)
Sets whether the exchange should be marked as handled or not.
|
OnExceptionDefinition |
continued(org.apache.camel.Predicate continued)
Sets whether the exchange should be marked as handled or not.
|
OnExceptionDefinition |
delayPattern(String delayPattern)
Sets the delay pattern with delay intervals.
|
protected String |
description() |
ExpressionSubElementDefinition |
getContinued() |
org.apache.camel.Predicate |
getContinuedPolicy() |
List<String> |
getExceptions() |
ExpressionSubElementDefinition |
getHandled() |
org.apache.camel.Predicate |
getHandledPolicy() |
String |
getLabel()
Returns a label to describe this node such as the expression if some kind of expression node
|
org.apache.camel.Processor |
getOnExceptionOccurred() |
String |
getOnExceptionOccurredRef() |
org.apache.camel.Processor |
getOnRedelivery() |
String |
getOnRedeliveryRef() |
WhenDefinition |
getOnWhen() |
protected RedeliveryPolicyDefinition |
getOrCreateRedeliveryPolicy() |
List<ProcessorDefinition<?>> |
getOutputs() |
String |
getRedeliveryPolicyRef() |
RedeliveryPolicyDefinition |
getRedeliveryPolicyType() |
ExpressionSubElementDefinition |
getRetryWhile() |
org.apache.camel.Predicate |
getRetryWhilePolicy() |
String |
getShortName() |
String |
getUseOriginalBody() |
String |
getUseOriginalMessage() |
OnExceptionDefinition |
handled(boolean handled)
Sets whether the exchange should be marked as handled or not.
|
OnExceptionDefinition |
handled(org.apache.camel.Expression handled)
Sets whether the exchange should be marked as handled or not.
|
OnExceptionDefinition |
handled(org.apache.camel.Predicate handled)
Sets whether the exchange should be marked as handled or not.
|
boolean |
isAbstract()
Whether this model is abstract or not.
|
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(org.apache.camel.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(org.apache.camel.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(org.apache.camel.Predicate predicate)
Sets an additional predicate that should be true before the onException is triggered.
|
OnExceptionDefinition |
redeliveryDelay(long delay)
Sets the initial redelivery delay
|
OnExceptionDefinition |
redeliveryDelay(String delay)
Sets the initial redelivery delay (supports property placeholders)
|
OnExceptionDefinition |
redeliveryPolicyRef(String redeliveryPolicyRef)
Sets a reference to a
RedeliveryPolicy to lookup in the Registry to be used. |
OnExceptionDefinition |
retriesExhaustedLogLevel(org.apache.camel.LoggingLevel retriesExhaustedLogLevel)
Sets the logging level to use when retries has exhausted
|
OnExceptionDefinition |
retryAttemptedLogLevel(org.apache.camel.LoggingLevel retryAttemptedLogLevel)
Sets the logging level to use for logging retry attempts
|
OnExceptionDefinition |
retryWhile(org.apache.camel.Predicate retryWhile)
Sets the retry while predicate.
|
void |
setContinued(ExpressionSubElementDefinition continued) |
void |
setContinuedPolicy(org.apache.camel.Predicate continuedPolicy) |
void |
setExceptions(List<String> exceptions)
A set of exceptions to react upon.
|
void |
setHandled(ExpressionSubElementDefinition handled) |
void |
setHandledPolicy(org.apache.camel.Predicate handledPolicy) |
void |
setOnExceptionOccurred(org.apache.camel.Processor onExceptionOccurred) |
void |
setOnExceptionOccurredRef(String onExceptionOccurredRef) |
void |
setOnRedelivery(org.apache.camel.Processor onRedelivery) |
void |
setOnRedeliveryRef(String onRedeliveryRef) |
void |
setOnWhen(WhenDefinition onWhen) |
void |
setOutputs(List<ProcessorDefinition<?>> outputs) |
void |
setParent(ProcessorDefinition<?> parent) |
void |
setRedeliveryPolicyRef(String redeliveryPolicyRef) |
void |
setRedeliveryPolicyType(RedeliveryPolicyDefinition redeliveryPolicyType)
Used for configuring redelivery options
|
void |
setRetryWhile(ExpressionSubElementDefinition retryWhile) |
void |
setRetryWhilePolicy(org.apache.camel.Predicate retryWhilePolicy) |
void |
setRouteScoped(boolean routeScoped) |
void |
setUseOriginalBody(String useOriginalBody) |
void |
setUseOriginalMessage(String useOriginalMessage) |
String |
toString() |
OnExceptionDefinition |
useCollisionAvoidance()
Turn on collision avoidance.
|
OnExceptionDefinition |
useExponentialBackOff()
Turn on exponential back off
|
OnExceptionDefinition |
useOriginalBody()
Will use the original input
Message body (original body only) when an
Exchange is moved to the dead letter queue. |
OnExceptionDefinition |
useOriginalMessage()
Will use the original input
Message (original body and headers) when an
Exchange is moved to the dead letter queue. |
void |
validateConfiguration() |
addInterceptStrategy, addOutput, aggregate, aggregate, aggregate, aggregate, bean, bean, bean, bean, bean, bean, bean, bean, bean, bean, bean, choice, circuitBreaker, claimCheck, claimCheck, claimCheck, claimCheck, clearOutput, configureChild, convertBodyTo, convertBodyTo, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endCircuitBreaker, endDoTry, endParent, endRest, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, filter, filter, filter, filter, getIndex, getInterceptStrategies, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, isInheritErrorHandler, isWrappingEntireOutput, kamelet, loadBalance, loadBalance, log, log, log, log, log, log, loop, loop, loop, loopDoWhile, loopDoWhile, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, pipeline, pipeline, pipeline, pipeline, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, preCreateProcessor, process, process, process, recipientList, recipientList, recipientList, recipientList, removeHeader, removeHeaders, removeHeaders, removeProperties, removeProperties, removeProperty, resequence, resequence, rollback, rollback, routeDescription, routeGroup, routeId, routingSlip, routingSlip, routingSlip, saga, sample, sample, sample, sample, script, script, serviceCall, serviceCall, serviceCall, setBody, setBody, setBody, setExchangePattern, setHeader, setHeader, setHeader, setInheritErrorHandler, setProperty, setProperty, setProperty, sort, sort, sort, split, split, split, split, startupOrder, step, step, stop, threads, threads, threads, threads, throttle, throttle, throttle, throttle, throttle, throwException, throwException, to, to, to, to, to, to, to, to, to, to, to, to, to, to, toD, toD, toD, toD, toD, toD, toD, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap
description, description, getCustomId, getDescription, getDescriptionText, getId, hasCustomIdAssigned, idOrCreate, setCustomId, setDescription, setGeneratedId, setId
public OnExceptionDefinition()
public OnExceptionDefinition(List<Class<? extends Throwable>> exceptionClasses)
public void setRouteScoped(boolean routeScoped)
public boolean isRouteScoped()
public void setParent(ProcessorDefinition<?> parent)
setParent
in class ProcessorDefinition<OnExceptionDefinition>
public String toString()
toString
in class OutputDefinition<OnExceptionDefinition>
protected String description()
public String getShortName()
getShortName
in interface org.apache.camel.NamedNode
getShortName
in class OutputDefinition<OnExceptionDefinition>
public String getLabel()
ProcessorDefinition
getLabel
in interface org.apache.camel.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 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(@AsPredicate org.apache.camel.Predicate handled)
handled
- predicate that determines true or falsepublic OnExceptionDefinition handled(@AsPredicate org.apache.camel.Expression handled)
handled
- expression that determines true or falsepublic OnExceptionDefinition continued(boolean continued)
continued
- continued or notpublic OnExceptionDefinition continued(@AsPredicate org.apache.camel.Predicate continued)
continued
- predicate that determines true or falsepublic OnExceptionDefinition continued(@AsPredicate org.apache.camel.Expression continued)
continued
- expression that determines true or falsepublic OnExceptionDefinition onWhen(@AsPredicate org.apache.camel.Predicate predicate)
predicate
- predicate that determines true or falsepublic OnExceptionDefinition retryWhile(@AsPredicate org.apache.camel.Predicate retryWhile)
retryWhile
- predicate that determines when to stop retryingpublic 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(org.apache.camel.LoggingLevel retriesExhaustedLogLevel)
retriesExhaustedLogLevel
- the logging levelpublic OnExceptionDefinition retryAttemptedLogLevel(org.apache.camel.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 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 patternpublic OnExceptionDefinition useOriginalMessage()
Message
(original body and headers) when an
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 message we use the original IN
message instead. This allows you to store the original input in the dead letter queue instead of the inprogress
snapshot of the IN message. 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 message is the same as when Camel received it. So you should be
able to send the Exchange
to the same input.
The difference between useOriginalMessage and useOriginalBody is that the former includes both the original body
and headers, where as the latter only includes the original body. You can use the latter to enrich the message
with custom headers and include the original message body. The former wont let you do this, as its using the
original message body and headers as they are. You cannot enable both useOriginalMessage and useOriginalBody.
Important: The original input means the input message that are bounded by the current
UnitOfWork
. An unit of work typically spans one route, or multiple routes if they
are connected using internal endpoints such as direct or seda. When messages is passed via external endpoints
such as JMS or HTTP then the consumer will create a new unit of work, with the message it received as input as
the original input. Also some EIP patterns such as splitter, multicast, will create a new unit of work boundary
for the messages in their sub-route (eg the splitted message); however these EIPs have an option named
shareUnitOfWork which allows to combine with the parent unit of work in regard to error handling and
therefore use the parent original message.
By default this feature is off.useOriginalBody()
public OnExceptionDefinition useOriginalBody()
Message
body (original body only) when an
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 message we use the original IN
message instead. This allows you to store the original input in the dead letter queue instead of the inprogress
snapshot of the IN message. 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 message is the same as when Camel received it. So you should be
able to send the Exchange
to the same input.
The difference between useOriginalMessage and useOriginalBody is that the former includes both the original body
and headers, where as the latter only includes the original body. You can use the latter to enrich the message
with custom headers and include the original message body. The former wont let you do this, as its using the
original message body and headers as they are. You cannot enable both useOriginalMessage and useOriginalBody.
Important: The original input means the input message that are bounded by the current
UnitOfWork
. An unit of work typically spans one route, or multiple routes if they
are connected using internal endpoints such as direct or seda. When messages is passed via external endpoints
such as JMS or HTTP then the consumer will create a new unit of work, with the message it received as input as
the original input. Also some EIP patterns such as splitter, multicast, will create a new unit of work boundary
for the messages in their sub-route (eg the splitted message); however these EIPs have an option named
shareUnitOfWork which allows to combine with the parent unit of work in regard to error handling and
therefore use the parent original message.
By default this feature is off.useOriginalMessage()
public OnExceptionDefinition onRedelivery(org.apache.camel.Processor processor)
Exchange
before its being redelivered.public OnExceptionDefinition onRedeliveryRef(String ref)
Exchange
before its being redelivered.ref
- reference to the processorpublic OnExceptionDefinition onExceptionOccurred(org.apache.camel.Processor processor)
public OnExceptionDefinition onExceptionOccurredRef(String ref)
ref
- reference to the processorpublic List<ProcessorDefinition<?>> getOutputs()
getOutputs
in class OutputDefinition<OnExceptionDefinition>
public void setOutputs(List<ProcessorDefinition<?>> outputs)
setOutputs
in class OutputDefinition<OnExceptionDefinition>
public RedeliveryPolicyDefinition getRedeliveryPolicyType()
public void setRedeliveryPolicyType(RedeliveryPolicyDefinition redeliveryPolicyType)
public String getRedeliveryPolicyRef()
public void setRedeliveryPolicyRef(String redeliveryPolicyRef)
public org.apache.camel.Predicate getHandledPolicy()
public void setHandled(ExpressionSubElementDefinition handled)
public ExpressionSubElementDefinition getContinued()
public void setContinued(ExpressionSubElementDefinition continued)
public ExpressionSubElementDefinition getHandled()
public void setHandledPolicy(org.apache.camel.Predicate handledPolicy)
public org.apache.camel.Predicate getContinuedPolicy()
public void setContinuedPolicy(org.apache.camel.Predicate continuedPolicy)
public WhenDefinition getOnWhen()
public void setOnWhen(WhenDefinition onWhen)
public ExpressionSubElementDefinition getRetryWhile()
public void setRetryWhile(ExpressionSubElementDefinition retryWhile)
public org.apache.camel.Predicate getRetryWhilePolicy()
public void setRetryWhilePolicy(org.apache.camel.Predicate retryWhilePolicy)
public org.apache.camel.Processor getOnRedelivery()
public void setOnRedelivery(org.apache.camel.Processor onRedelivery)
public String getOnRedeliveryRef()
public void setOnRedeliveryRef(String onRedeliveryRef)
public org.apache.camel.Processor getOnExceptionOccurred()
public void setOnExceptionOccurred(org.apache.camel.Processor onExceptionOccurred)
public String getOnExceptionOccurredRef()
public void setOnExceptionOccurredRef(String onExceptionOccurredRef)
public String getUseOriginalMessage()
public void setUseOriginalMessage(String useOriginalMessage)
public String getUseOriginalBody()
public void setUseOriginalBody(String useOriginalBody)
protected RedeliveryPolicyDefinition getOrCreateRedeliveryPolicy()
Apache Camel