Package org.apache.camel.model
Class OnExceptionDefinition
- java.lang.Object
-
- org.apache.camel.model.OptionalIdentifiedDefinition<Type>
-
- org.apache.camel.model.ProcessorDefinition<Type>
-
- org.apache.camel.model.OutputDefinition<OnExceptionDefinition>
-
- org.apache.camel.model.OnExceptionDefinition
-
- All Implemented Interfaces:
org.apache.camel.CamelContextAware
,org.apache.camel.LineNumberAware
,Block
,OutputNode
,org.apache.camel.NamedNode
,org.apache.camel.spi.HasId
,org.apache.camel.spi.IdAware
@Metadata(label="error") public class OnExceptionDefinition extends OutputDefinition<OnExceptionDefinition>
Route to be executed when an exception is thrown
-
-
Field Summary
-
Fields inherited from class org.apache.camel.model.OutputDefinition
outputs
-
Fields inherited from class org.apache.camel.model.ProcessorDefinition
inheritErrorHandler
-
-
Constructor Summary
Constructors Constructor Description OnExceptionDefinition()
OnExceptionDefinition(Class<? extends Throwable> exceptionType)
OnExceptionDefinition(List<Class<? extends Throwable>> exceptionClasses)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OnExceptionDefinition
asyncDelayedRedelivery()
Allow asynchronous delayed redelivery.OnExceptionDefinition
backOffMultiplier(double backOffMultiplier)
Sets the back off multiplierOnExceptionDefinition
backOffMultiplier(String backOffMultiplier)
Sets the back off multiplier (supports property placeholders)OnExceptionDefinition
collisionAvoidanceFactor(double collisionAvoidanceFactor)
Sets the collision avoidance factorOnExceptionDefinition
collisionAvoidanceFactor(String collisionAvoidanceFactor)
Sets the collision avoidance factor (supports property placeholders)OnExceptionDefinition
collisionAvoidancePercent(double collisionAvoidancePercent)
Sets the collision avoidance percentageOnExceptionDefinition
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 nodeorg.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.)OnExceptionDefinition
logContinued(boolean logContinued)
Sets whether to log errors even if its continuedOnExceptionDefinition
logContinued(String logContinued)
Sets whether to log errors even if its continued (supports property placeholders)OnExceptionDefinition
logExhausted(boolean logExhausted)
Sets whether to log exhausted exceptionsOnExceptionDefinition
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 historyOnExceptionDefinition
logExhaustedMessageHistory(String logExhaustedMessageHistory)
Sets whether to log exhausted exceptions with message historyOnExceptionDefinition
logHandled(boolean logHandled)
Sets whether to log errors even if its handledOnExceptionDefinition
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 attemptsOnExceptionDefinition
logRetryAttempted(String logRetryAttempted)
Sets whether to log retry attempts (supports property placeholders)OnExceptionDefinition
logRetryStackTrace(boolean logRetryStackTrace)
Sets whether to log stacktrace for failed redelivery attemptsOnExceptionDefinition
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 foreverOnExceptionDefinition
maximumRedeliveries(String maximumRedeliveries)
Sets the maximum redeliveries (supports property placeholders) 5 = default value 0 = no redeliveries -1 = redeliver foreverOnExceptionDefinition
maximumRedeliveryDelay(long maximumRedeliveryDelay)
Sets the maximum delay between redeliveryOnExceptionDefinition
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 delayOnExceptionDefinition
redeliveryDelay(String delay)
Sets the initial redelivery delay (supports property placeholders)OnExceptionDefinition
redeliveryPolicyRef(String redeliveryPolicyRef)
Sets a reference to a redelivery policy to lookup in theRegistry
to be used.OnExceptionDefinition
retriesExhaustedLogLevel(org.apache.camel.LoggingLevel retriesExhaustedLogLevel)
Sets the logging level to use when retries have been exhaustedOnExceptionDefinition
retryAttemptedLogLevel(org.apache.camel.LoggingLevel retryAttemptedLogLevel)
Sets the logging level to use for logging retry attemptsOnExceptionDefinition
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 optionsvoid
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 offOnExceptionDefinition
useOriginalBody()
Will use the original inputMessage
body (original body only) when anExchange
is moved to the dead letter queue.OnExceptionDefinition
useOriginalMessage()
Will use the original inputMessage
(original body and headers) when anExchange
is moved to the dead letter queue.void
validateConfiguration()
-
Methods inherited from class org.apache.camel.model.ProcessorDefinition
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, convertBodyTo, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endCircuitBreaker, endDoCatch, endDoTry, endParent, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, filter, filter, filter, filter, getIndex, getInterceptStrategies, getParent, getRouteConfiguration, 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, pausable, pausable, pausable, pausable, 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, resumable, resumable, resumable, rollback, rollback, routeDescription, routeGroup, routeId, routingSlip, routingSlip, routingSlip, saga, sample, sample, sample, sample, sample, script, script, serviceCall, serviceCall, serviceCall, setBody, setBody, setBody, setExchangePattern, setHeader, setHeader, setHeader, setInheritErrorHandler, setProperty, setProperty, setProperty, setRouteConfiguration, 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, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap
-
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, description, getCamelContext, getCustomId, getDescription, getDescriptionText, getId, getLineNumber, getLocation, hasCustomIdAssigned, idOrCreate, setCamelContext, setCustomId, setDescription, setGeneratedId, setId, setLineNumber, setLocation
-
-
-
-
Method Detail
-
setRouteScoped
public void setRouteScoped(boolean routeScoped)
-
isRouteScoped
public boolean isRouteScoped()
-
setParent
public void setParent(ProcessorDefinition<?> parent)
- Overrides:
setParent
in classProcessorDefinition<OnExceptionDefinition>
-
toString
public String toString()
- Overrides:
toString
in classOutputDefinition<OnExceptionDefinition>
-
description
protected String description()
-
getShortName
public String getShortName()
- Specified by:
getShortName
in interfaceorg.apache.camel.NamedNode
- Overrides:
getShortName
in classOutputDefinition<OnExceptionDefinition>
-
getLabel
public String getLabel()
Description copied from class:ProcessorDefinition
Returns a label to describe this node such as the expression if some kind of expression node- Specified by:
getLabel
in interfaceorg.apache.camel.NamedNode
- Overrides:
getLabel
in classProcessorDefinition<OnExceptionDefinition>
-
isAbstract
public boolean isAbstract()
Description copied from class:ProcessorDefinition
Whether this model is abstract or not. An abstract model is something that is used for configuring cross cutting concerns such as error handling, transaction policies, interceptors etc. Regular definitions is what is part of the route, such as ToDefinition, WireTapDefinition and the likes. Will by default return false to indicate regular definition, so all the abstract definitions must override this method and return true instead. This information is used in camel-spring to let Camel work a bit on the model provided by JAXB from the Spring XML file. This is needed to handle those cross cutting concerns properly. The Java DSL does not have this issue as it can work this out directly using the fluent builder methods.- Overrides:
isAbstract
in classProcessorDefinition<OnExceptionDefinition>
- Returns:
- true for abstract, otherwise false for regular.
-
isTopLevelOnly
public boolean isTopLevelOnly()
Description copied from class:ProcessorDefinition
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 theProcessorDefinition.addOutput(ProcessorDefinition)
method.- Overrides:
isTopLevelOnly
in classProcessorDefinition<OnExceptionDefinition>
-
validateConfiguration
public void validateConfiguration()
-
onException
public OnExceptionDefinition onException(Class<? extends Throwable> exceptionType)
Description copied from class:ProcessorDefinition
Exception clause for catching certain exceptions and handling them.- Overrides:
onException
in classProcessorDefinition<OnExceptionDefinition>
- Parameters:
exceptionType
- the exception to catch- Returns:
- the exception builder to configure
-
handled
public OnExceptionDefinition handled(boolean handled)
Sets whether the exchange should be marked as handled or not.- Parameters:
handled
- handled or not- Returns:
- the builder
-
handled
public OnExceptionDefinition handled(@AsPredicate org.apache.camel.Predicate handled)
Sets whether the exchange should be marked as handled or not.- Parameters:
handled
- predicate that determines true or false- Returns:
- the builder
-
handled
public OnExceptionDefinition handled(@AsPredicate org.apache.camel.Expression handled)
Sets whether the exchange should be marked as handled or not.- Parameters:
handled
- expression that determines true or false- Returns:
- the builder
-
continued
public OnExceptionDefinition continued(boolean continued)
Sets whether the exchange should handle and continue routing from the point of failure. If this option is enabled then its considered handled as well.- Parameters:
continued
- continued or not- Returns:
- the builder
-
continued
public OnExceptionDefinition continued(@AsPredicate org.apache.camel.Predicate continued)
Sets whether the exchange should be marked as handled or not. If this option is enabled then its considered handled as well.- Parameters:
continued
- predicate that determines true or false- Returns:
- the builder
-
continued
public OnExceptionDefinition continued(@AsPredicate org.apache.camel.Expression continued)
Sets whether the exchange should be marked as handled or not. If this option is enabled then its considered handled as well.- Parameters:
continued
- expression that determines true or false- Returns:
- the builder
-
onWhen
public OnExceptionDefinition onWhen(@AsPredicate org.apache.camel.Predicate predicate)
Sets an additional predicate that should be true before the onException is triggered. To be used for fine grained controlling whether a thrown exception should be intercepted by this exception type or not.- Parameters:
predicate
- predicate that determines true or false- Returns:
- the builder
-
retryWhile
public OnExceptionDefinition retryWhile(@AsPredicate org.apache.camel.Predicate retryWhile)
Sets the retry while predicate. Will continue retrying until predicate returns false.- Parameters:
retryWhile
- predicate that determines when to stop retrying- Returns:
- the builder
-
backOffMultiplier
public OnExceptionDefinition backOffMultiplier(double backOffMultiplier)
Sets the back off multiplier- Parameters:
backOffMultiplier
- the back off multiplier- Returns:
- the builder
-
backOffMultiplier
public OnExceptionDefinition backOffMultiplier(String backOffMultiplier)
Sets the back off multiplier (supports property placeholders)- Parameters:
backOffMultiplier
- the back off multiplier- Returns:
- the builder
-
collisionAvoidanceFactor
public OnExceptionDefinition collisionAvoidanceFactor(double collisionAvoidanceFactor)
Sets the collision avoidance factor- Parameters:
collisionAvoidanceFactor
- the factor- Returns:
- the builder
-
collisionAvoidanceFactor
public OnExceptionDefinition collisionAvoidanceFactor(String collisionAvoidanceFactor)
Sets the collision avoidance factor (supports property placeholders)- Parameters:
collisionAvoidanceFactor
- the factor- Returns:
- the builder
-
collisionAvoidancePercent
public OnExceptionDefinition collisionAvoidancePercent(double collisionAvoidancePercent)
Sets the collision avoidance percentage- Parameters:
collisionAvoidancePercent
- the percentage- Returns:
- the builder
-
redeliveryDelay
public OnExceptionDefinition redeliveryDelay(long delay)
Sets the initial redelivery delay- Parameters:
delay
- delay in millis- Returns:
- the builder
-
redeliveryDelay
public OnExceptionDefinition redeliveryDelay(String delay)
Sets the initial redelivery delay (supports property placeholders)- Parameters:
delay
- delay in millis- Returns:
- the builder
-
asyncDelayedRedelivery
public OnExceptionDefinition asyncDelayedRedelivery()
Allow asynchronous delayed redelivery.- Returns:
- the builder
-
retriesExhaustedLogLevel
public OnExceptionDefinition retriesExhaustedLogLevel(org.apache.camel.LoggingLevel retriesExhaustedLogLevel)
Sets the logging level to use when retries have been exhausted- Parameters:
retriesExhaustedLogLevel
- the logging level- Returns:
- the builder
-
retryAttemptedLogLevel
public OnExceptionDefinition retryAttemptedLogLevel(org.apache.camel.LoggingLevel retryAttemptedLogLevel)
Sets the logging level to use for logging retry attempts- Parameters:
retryAttemptedLogLevel
- the logging level- Returns:
- the builder
-
logStackTrace
public OnExceptionDefinition logStackTrace(boolean logStackTrace)
Sets whether to log stacktrace for failed messages.
-
logStackTrace
public OnExceptionDefinition logStackTrace(String logStackTrace)
Sets whether to log stacktrace for failed messages (supports property placeholders)
-
logRetryStackTrace
public OnExceptionDefinition logRetryStackTrace(boolean logRetryStackTrace)
Sets whether to log stacktrace for failed redelivery attempts
-
logRetryStackTrace
public OnExceptionDefinition logRetryStackTrace(String logRetryStackTrace)
Sets whether to log stacktrace for failed redelivery attempts (supports property placeholders)
-
logHandled
public OnExceptionDefinition logHandled(boolean logHandled)
Sets whether to log errors even if its handled
-
logHandled
public OnExceptionDefinition logHandled(String logHandled)
Sets whether to log errors even if its handled (supports property placeholders)
-
logNewException
public OnExceptionDefinition logNewException(boolean logNewException)
Sets whether new exceptions should be logged or not (supports property placeholders). Can be used to include or reduce verbose. A new exception is an exception that was thrown while handling a previous exception.
-
logNewException
public OnExceptionDefinition logNewException(String logNewException)
Sets whether new exceptions should be logged or not (supports property placeholders). Can be used to include or reduce verbose. A new exception is an exception that was thrown while handling a previous exception.
-
logContinued
public OnExceptionDefinition logContinued(boolean logContinued)
Sets whether to log errors even if its continued
-
logContinued
public OnExceptionDefinition logContinued(String logContinued)
Sets whether to log errors even if its continued (supports property placeholders)
-
logRetryAttempted
public OnExceptionDefinition logRetryAttempted(boolean logRetryAttempted)
Sets whether to log retry attempts
-
logRetryAttempted
public OnExceptionDefinition logRetryAttempted(String logRetryAttempted)
Sets whether to log retry attempts (supports property placeholders)
-
logExhausted
public OnExceptionDefinition logExhausted(boolean logExhausted)
Sets whether to log exhausted exceptions
-
logExhausted
public OnExceptionDefinition logExhausted(String logExhausted)
Sets whether to log exhausted exceptions (supports property placeholders)
-
logExhaustedMessageHistory
public OnExceptionDefinition logExhaustedMessageHistory(boolean logExhaustedMessageHistory)
Sets whether to log exhausted exceptions with message history
-
logExhaustedMessageHistory
public OnExceptionDefinition logExhaustedMessageHistory(String logExhaustedMessageHistory)
Sets whether to log exhausted exceptions with message history
-
logExhaustedMessageBody
public OnExceptionDefinition logExhaustedMessageBody(boolean logExhaustedMessageBody)
Sets whether to log exhausted message body with message history. Requires logExhaustedMessageHistory to be enabled.
-
logExhaustedMessageBody
public OnExceptionDefinition logExhaustedMessageBody(String logExhaustedMessageBody)
Sets whether to log exhausted message body with message history. Requires logExhaustedMessageHistory to be enabled.
-
maximumRedeliveries
public OnExceptionDefinition maximumRedeliveries(int maximumRedeliveries)
Sets the maximum redeliveries- 5 = default value
- 0 = no redeliveries
- -1 = redeliver forever
- Parameters:
maximumRedeliveries
- the value- Returns:
- the builder
-
maximumRedeliveries
public OnExceptionDefinition maximumRedeliveries(String maximumRedeliveries)
Sets the maximum redeliveries (supports property placeholders)- 5 = default value
- 0 = no redeliveries
- -1 = redeliver forever
- Parameters:
maximumRedeliveries
- the value- Returns:
- the builder
-
useCollisionAvoidance
public OnExceptionDefinition useCollisionAvoidance()
Turn on collision avoidance.- Returns:
- the builder
-
useExponentialBackOff
public OnExceptionDefinition useExponentialBackOff()
Turn on exponential back off- Returns:
- the builder
-
maximumRedeliveryDelay
public OnExceptionDefinition maximumRedeliveryDelay(long maximumRedeliveryDelay)
Sets the maximum delay between redelivery- Parameters:
maximumRedeliveryDelay
- the delay in millis- Returns:
- the builder
-
maximumRedeliveryDelay
public OnExceptionDefinition maximumRedeliveryDelay(String maximumRedeliveryDelay)
Sets the maximum delay between redelivery (supports property placeholders)- Parameters:
maximumRedeliveryDelay
- the delay in millis- Returns:
- the builder
-
redeliveryPolicyRef
public OnExceptionDefinition redeliveryPolicyRef(String redeliveryPolicyRef)
Sets a reference to a redelivery policy to lookup in theRegistry
to be used.- Parameters:
redeliveryPolicyRef
- reference to use for lookup- Returns:
- the builder
-
delayPattern
public OnExceptionDefinition delayPattern(String delayPattern)
Sets the delay pattern with delay intervals.- Parameters:
delayPattern
- the delay pattern- Returns:
- the builder
-
useOriginalMessage
public OnExceptionDefinition useOriginalMessage()
Will use the original inputMessage
(original body and headers) when anExchange
is moved to the dead letter queue. Notice: this only applies when all redeliveries attempt have failed and theExchange
is doomed for failure.
Instead of using the current inprogressExchange
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 theExchange
again as the IN message is the same as when Camel received it. So you should be able to send theExchange
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 currentUnitOfWork
. 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 split 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.- Returns:
- the builder
- See Also:
useOriginalBody()
-
useOriginalBody
public OnExceptionDefinition useOriginalBody()
Will use the original inputMessage
body (original body only) when anExchange
is moved to the dead letter queue. Notice: this only applies when all redeliveries attempt have failed and theExchange
is doomed for failure.
Instead of using the current inprogressExchange
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 theExchange
again as the IN message is the same as when Camel received it. So you should be able to send theExchange
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 currentUnitOfWork
. 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 split 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.- Returns:
- the builder
- See Also:
useOriginalMessage()
-
onRedelivery
public OnExceptionDefinition onRedelivery(org.apache.camel.Processor processor)
Sets a processor that should be processed before a redelivery attempt. Can be used to change theExchange
before its being redelivered.
-
onRedeliveryRef
public OnExceptionDefinition onRedeliveryRef(String ref)
Sets a reference to a processor that should be processed before a redelivery attempt. Can be used to change theExchange
before its being redelivered.- Parameters:
ref
- reference to the processor
-
onExceptionOccurred
public OnExceptionDefinition onExceptionOccurred(org.apache.camel.Processor processor)
Sets a processor that should be processed just after an exception occurred. Can be used to perform custom logging about the occurred exception at the exact time it happened. Important: Any exception thrown from this processor will be ignored.
-
onExceptionOccurredRef
public OnExceptionDefinition onExceptionOccurredRef(String ref)
Sets a reference to a processor that should be processed just after an exception occurred. Can be used to perform custom logging about the occurred exception at the exact time it happened. Important: Any exception thrown from this processor will be ignored.- Parameters:
ref
- reference to the processor
-
getOutputs
public List<ProcessorDefinition<?>> getOutputs()
- Overrides:
getOutputs
in classOutputDefinition<OnExceptionDefinition>
-
setOutputs
public void setOutputs(List<ProcessorDefinition<?>> outputs)
- Overrides:
setOutputs
in classOutputDefinition<OnExceptionDefinition>
-
setExceptions
public void setExceptions(List<String> exceptions)
A set of exceptions to react upon.
-
getRedeliveryPolicyType
public RedeliveryPolicyDefinition getRedeliveryPolicyType()
-
setRedeliveryPolicyType
public void setRedeliveryPolicyType(RedeliveryPolicyDefinition redeliveryPolicyType)
Used for configuring redelivery options
-
getRedeliveryPolicyRef
public String getRedeliveryPolicyRef()
-
setRedeliveryPolicyRef
public void setRedeliveryPolicyRef(String redeliveryPolicyRef)
-
getHandledPolicy
public org.apache.camel.Predicate getHandledPolicy()
-
setHandled
public void setHandled(ExpressionSubElementDefinition handled)
-
getContinued
public ExpressionSubElementDefinition getContinued()
-
setContinued
public void setContinued(ExpressionSubElementDefinition continued)
-
getHandled
public ExpressionSubElementDefinition getHandled()
-
setHandledPolicy
public void setHandledPolicy(org.apache.camel.Predicate handledPolicy)
-
getContinuedPolicy
public org.apache.camel.Predicate getContinuedPolicy()
-
setContinuedPolicy
public void setContinuedPolicy(org.apache.camel.Predicate continuedPolicy)
-
getOnWhen
public WhenDefinition getOnWhen()
-
setOnWhen
public void setOnWhen(WhenDefinition onWhen)
-
getRetryWhile
public ExpressionSubElementDefinition getRetryWhile()
-
setRetryWhile
public void setRetryWhile(ExpressionSubElementDefinition retryWhile)
-
getRetryWhilePolicy
public org.apache.camel.Predicate getRetryWhilePolicy()
-
setRetryWhilePolicy
public void setRetryWhilePolicy(org.apache.camel.Predicate retryWhilePolicy)
-
getOnRedelivery
public org.apache.camel.Processor getOnRedelivery()
-
setOnRedelivery
public void setOnRedelivery(org.apache.camel.Processor onRedelivery)
-
getOnRedeliveryRef
public String getOnRedeliveryRef()
-
setOnRedeliveryRef
public void setOnRedeliveryRef(String onRedeliveryRef)
-
getOnExceptionOccurred
public org.apache.camel.Processor getOnExceptionOccurred()
-
setOnExceptionOccurred
public void setOnExceptionOccurred(org.apache.camel.Processor onExceptionOccurred)
-
getOnExceptionOccurredRef
public String getOnExceptionOccurredRef()
-
setOnExceptionOccurredRef
public void setOnExceptionOccurredRef(String onExceptionOccurredRef)
-
getUseOriginalMessage
public String getUseOriginalMessage()
-
setUseOriginalMessage
public void setUseOriginalMessage(String useOriginalMessage)
-
getUseOriginalBody
public String getUseOriginalBody()
-
setUseOriginalBody
public void setUseOriginalBody(String useOriginalBody)
-
getOrCreateRedeliveryPolicy
protected RedeliveryPolicyDefinition getOrCreateRedeliveryPolicy()
-
-