Package org.apache.camel.spring
Class ErrorHandlerDefinition
- java.lang.Object
-
- org.apache.camel.model.IdentifiedType
-
- org.apache.camel.spring.ErrorHandlerDefinition
-
@Metadata(label="spring,configuration,error") public class ErrorHandlerDefinition extends org.apache.camel.model.IdentifiedType
Error handler settings
-
-
Constructor Summary
Constructors Constructor Description ErrorHandlerDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDeadLetterHandleNewException()StringgetDeadLetterUri()StringgetExecutorServiceRef()org.apache.camel.LoggingLevelgetLevel()StringgetLogName()StringgetOnExceptionOccurredRef()StringgetOnPrepareFailureRef()StringgetOnRedeliveryRef()CamelRedeliveryPolicyFactoryBeangetRedeliveryPolicy()StringgetRedeliveryPolicyRef()StringgetRetryWhileRef()org.apache.camel.LoggingLevelgetRollbackLoggingLevel()StringgetTransactionManagerRef()StringgetTransactionTemplateRef()ErrorHandlerTypegetType()BooleangetUseOriginalBody()BooleangetUseOriginalMessage()voidsetDeadLetterHandleNewException(String deadLetterHandleNewException)Whether the dead letter channel should handle (and ignore) any new exception that may been thrown during sending the message to the dead letter endpoint.voidsetDeadLetterUri(String deadLetterUri)The dead letter endpoint uri for the Dead Letter error handler.voidsetExecutorServiceRef(String executorServiceRef)Sets a reference to a thread pool to be used by the error handlervoidsetLevel(org.apache.camel.LoggingLevel level)Logging level to use when using the logging error handler type.voidsetLogName(String logName)Name of the logger to use for the logging error handlervoidsetOnExceptionOccurredRef(String onExceptionOccurredRef)Sets a reference to a processor that should be processed just after an exception occurred.voidsetOnPrepareFailureRef(String onPrepareFailureRef)Sets a reference to a processor to prepare theExchangebefore handled by the failure processor / dead letter channel.voidsetOnRedeliveryRef(String onRedeliveryRef)Sets a reference to a processor that should be processed before a redelivery attempt.voidsetRedeliveryPolicy(CamelRedeliveryPolicyFactoryBean redeliveryPolicy)Sets the redelivery settingsvoidsetRedeliveryPolicyRef(String redeliveryPolicyRef)Sets a reference to aRedeliveryPolicyto be used for redelivery settings.voidsetRetryWhileRef(String retryWhileRef)Sets a reference to an retry while expression.voidsetRollbackLoggingLevel(org.apache.camel.LoggingLevel rollbackLoggingLevel)Sets the logging level to use for logging transactional rollback.voidsetTransactionManagerRef(String transactionManagerRef)References to thePlatformTransactionManagerto use with the transaction error handler.voidsetTransactionTemplateRef(String transactionTemplateRef)References to theTransactionTemplateto use with the transaction error handler.voidsetType(ErrorHandlerType type)The type of the error handlervoidsetUseOriginalBody(Boolean useOriginalBody)Will use the original inputMessagebody (original body only) when anExchangeis moved to the dead letter queue.voidsetUseOriginalMessage(Boolean useOriginalMessage)Will use the original inputMessage(original body and headers) when anExchangeis moved to the dead letter queue.
-
-
-
Constructor Detail
-
ErrorHandlerDefinition
public ErrorHandlerDefinition()
-
-
Method Detail
-
getType
public ErrorHandlerType getType()
-
setType
public void setType(ErrorHandlerType type)
The type of the error handler
-
getDeadLetterUri
public String getDeadLetterUri()
-
setDeadLetterUri
public void setDeadLetterUri(String deadLetterUri)
The dead letter endpoint uri for the Dead Letter error handler.
-
getDeadLetterHandleNewException
public String getDeadLetterHandleNewException()
-
setDeadLetterHandleNewException
public void setDeadLetterHandleNewException(String deadLetterHandleNewException)
Whether the dead letter channel should handle (and ignore) any new exception that may been thrown during sending the message to the dead letter endpoint. The default value is true which means any such kind of exception is handled and ignored. Set this to false to let the exception be propagated back on theExchange. This can be used in situations where you use transactions, and want to use Camel's dead letter channel to deal with exceptions during routing, but if the dead letter channel itself fails because of a new exception being thrown, then by setting this to false the new exceptions is propagated back and set on theExchange, which allows the transaction to detect the exception, and rollback.
-
getLevel
public org.apache.camel.LoggingLevel getLevel()
-
setLevel
public void setLevel(org.apache.camel.LoggingLevel level)
Logging level to use when using the logging error handler type.
-
getRollbackLoggingLevel
public org.apache.camel.LoggingLevel getRollbackLoggingLevel()
-
setRollbackLoggingLevel
public void setRollbackLoggingLevel(org.apache.camel.LoggingLevel rollbackLoggingLevel)
Sets the logging level to use for logging transactional rollback. This option is default WARN.
-
getLogName
public String getLogName()
-
setLogName
public void setLogName(String logName)
Name of the logger to use for the logging error handler
-
getUseOriginalMessage
public Boolean getUseOriginalMessage()
-
setUseOriginalMessage
public void setUseOriginalMessage(Boolean useOriginalMessage)
Will use the original inputMessage(original body and headers) when anExchangeis moved to the dead letter queue. Notice: this only applies when all redeliveries attempt have failed and theExchangeis doomed for failure.
Instead of using the current inprogressExchangeIN 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 theExchangeagain as the IN message is the same as when Camel received it. So you should be able to send theExchangeto 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 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.- See Also:
setUseOriginalBody(Boolean)
-
getUseOriginalBody
public Boolean getUseOriginalBody()
-
setUseOriginalBody
public void setUseOriginalBody(Boolean useOriginalBody)
Will use the original inputMessagebody (original body only) when anExchangeis moved to the dead letter queue. Notice: this only applies when all redeliveries attempt have failed and theExchangeis doomed for failure.
Instead of using the current inprogressExchangeIN 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 theExchangeagain as the IN message is the same as when Camel received it. So you should be able to send theExchangeto 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 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.- See Also:
setUseOriginalMessage(Boolean)
-
getTransactionTemplateRef
public String getTransactionTemplateRef()
-
setTransactionTemplateRef
public void setTransactionTemplateRef(String transactionTemplateRef)
References to theTransactionTemplateto use with the transaction error handler.
-
getTransactionManagerRef
public String getTransactionManagerRef()
-
setTransactionManagerRef
public void setTransactionManagerRef(String transactionManagerRef)
References to thePlatformTransactionManagerto use with the transaction error handler.
-
getOnRedeliveryRef
public String getOnRedeliveryRef()
-
setOnRedeliveryRef
public void setOnRedeliveryRef(String onRedeliveryRef)
Sets a reference to a processor that should be processed before a redelivery attempt. Can be used to change theExchangebefore its being redelivered.
-
getOnExceptionOccurredRef
public String getOnExceptionOccurredRef()
-
setOnExceptionOccurredRef
public void setOnExceptionOccurredRef(String onExceptionOccurredRef)
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.
-
getOnPrepareFailureRef
public String getOnPrepareFailureRef()
-
setOnPrepareFailureRef
public void setOnPrepareFailureRef(String onPrepareFailureRef)
Sets a reference to a processor to prepare theExchangebefore handled by the failure processor / dead letter channel. This allows for example to enrich the message before sending to a dead letter queue.
-
getRetryWhileRef
public String getRetryWhileRef()
-
setRetryWhileRef
public void setRetryWhileRef(String retryWhileRef)
Sets a reference to an retry while expression. Will continue retrying until expression evaluates to false.
-
getRedeliveryPolicyRef
public String getRedeliveryPolicyRef()
-
setRedeliveryPolicyRef
public void setRedeliveryPolicyRef(String redeliveryPolicyRef)
Sets a reference to aRedeliveryPolicyto be used for redelivery settings.
-
getExecutorServiceRef
public String getExecutorServiceRef()
-
setExecutorServiceRef
public void setExecutorServiceRef(String executorServiceRef)
Sets a reference to a thread pool to be used by the error handler
-
getRedeliveryPolicy
public CamelRedeliveryPolicyFactoryBean getRedeliveryPolicy()
-
setRedeliveryPolicy
public void setRedeliveryPolicy(CamelRedeliveryPolicyFactoryBean redeliveryPolicy)
Sets the redelivery settings
-
-