Class DeadLetterChannelDefinition

All Implemented Interfaces:
org.apache.camel.ErrorHandlerFactory
Direct Known Subclasses:
DeadLetterChannelBuilder

@Metadata(label="configuration,error") public class DeadLetterChannelDefinition extends DefaultErrorHandlerDefinition
Error handler with dead letter queue.
  • Constructor Details

    • DeadLetterChannelDefinition

      public DeadLetterChannelDefinition()
    • DeadLetterChannelDefinition

      public DeadLetterChannelDefinition(String deadLetterUri)
    • DeadLetterChannelDefinition

      public DeadLetterChannelDefinition(org.apache.camel.Endpoint deadLetterUri)
  • Method Details

    • createRedeliveryPolicy

      protected RedeliveryPolicyDefinition createRedeliveryPolicy()
      Overrides:
      createRedeliveryPolicy in class DefaultErrorHandlerDefinition
    • 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 the Exchange. 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 the Exchange, which allows the transaction to detect the exception, and rollback.

    • supportTransacted

      public boolean supportTransacted()
      Specified by:
      supportTransacted in interface org.apache.camel.ErrorHandlerFactory
      Overrides:
      supportTransacted in class DefaultErrorHandlerDefinition
    • cloneBuilder

      public org.apache.camel.ErrorHandlerFactory cloneBuilder()
      Specified by:
      cloneBuilder in interface org.apache.camel.ErrorHandlerFactory
      Overrides:
      cloneBuilder in class DefaultErrorHandlerDefinition
    • cloneBuilder

      protected void cloneBuilder(DeadLetterChannelDefinition other)
    • deadLetterUri

      public DeadLetterChannelDefinition deadLetterUri(String deadLetterUri)
      The dead letter endpoint uri for the Dead Letter error handler.
    • deadLetterHandleNewException

      public DefaultErrorHandlerDefinition deadLetterHandleNewException(boolean handleNewException)
      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 the Exchange. 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 the Exchange, which allows the transaction to detect the exception, and rollback.

      Parameters:
      handleNewException - true to handle (and ignore), false to catch and propagated the exception on the Exchange
      Returns:
      the builder