org.apache.camel.builder
Class DeadLetterChannelBuilder

java.lang.Object
  extended by org.apache.camel.builder.ErrorHandlerBuilderSupport
      extended by org.apache.camel.builder.DeadLetterChannelBuilder
All Implemented Interfaces:
ErrorHandlerBuilder

public class DeadLetterChannelBuilder
extends ErrorHandlerBuilderSupport

A builder of a Dead Letter Channel

Version:
$Revision: 774230 $

Constructor Summary
DeadLetterChannelBuilder()
          Creates a default DeadLetterChannel with a default endpoint
DeadLetterChannelBuilder(Endpoint deadLetter)
          Creates a DeadLetterChannel using the given endpoint
DeadLetterChannelBuilder(String uri)
          Creates a DeadLetterChannel using the given endpoint
 
Method Summary
 DeadLetterChannelBuilder backOffMultiplier(double backOffMultiplier)
           
 DeadLetterChannelBuilder collisionAvoidancePercent(short collisionAvoidancePercent)
           
 Processor createErrorHandler(RouteContext routeContext, Processor processor)
          Creates the error handler interceptor
 DeadLetterChannelBuilder delay(long delay)
           
 DeadLetterChannelBuilder delayPattern(String delayPattern)
           
 DeadLetterChannelBuilder disableRedelivery()
           
 DeadLetterChannelBuilder exceptionPolicyStrategy(ExceptionPolicyStrategy exceptionPolicyStrategy)
          Sets the exception policy to use
 Endpoint getDeadLetter()
           
 String getDeadLetterUri()
           
 ExceptionPolicyStrategy getExceptionPolicyStrategy()
          Sets the exception policy strategy to use for resolving the OnExceptionDefinition to use for a given thrown exception
 Processor getFailureProcessor()
           
 Predicate getHandledPolicy()
           
 Logger getLogger()
           
 Processor getOnRedelivery()
           
 RedeliveryPolicy getRedeliveryPolicy()
           
 DeadLetterChannelBuilder handled(boolean handled)
          Sets whether the exchange should be marked as handled or not.
 DeadLetterChannelBuilder handled(Expression handled)
          Sets whether the exchange should be marked as handled or not.
 DeadLetterChannelBuilder handled(Predicate handled)
          Sets whether the exchange should be marked as handled or not.
 boolean isUseOriginalBody()
           
 DeadLetterChannelBuilder log(Class log)
          Sets the log used for caught exceptions
 DeadLetterChannelBuilder log(org.apache.commons.logging.Log log)
          Sets the log used for caught exceptions
 DeadLetterChannelBuilder log(String log)
          Sets the log used for caught exceptions
 DeadLetterChannelBuilder logger(Logger logger)
          Sets the logger used for caught exceptions
 DeadLetterChannelBuilder loggingLevel(LoggingLevel level)
          Sets the logging level of exceptions caught
 DeadLetterChannelBuilder logStackTrace(boolean logStackTrace)
           
 DeadLetterChannelBuilder maximumRedeliveries(int maximumRedeliveries)
           
 DeadLetterChannelBuilder maximumRedeliveryDelay(long maximumRedeliveryDelay)
           
 DeadLetterChannelBuilder onRedelivery(Processor processor)
          Sets a processor that should be processed before a redelivey attempt.
 DeadLetterChannelBuilder retriesExhaustedLogLevel(LoggingLevel retriesExhaustedLogLevel)
           
 DeadLetterChannelBuilder retryAttemptedLogLevel(LoggingLevel retryAttemptedLogLevel)
           
 void setDeadLetter(Endpoint deadLetter)
           
 void setDeadLetterUri(String deadLetterUri)
           
 void setExceptionPolicyStrategy(ExceptionPolicyStrategy exceptionPolicyStrategy)
          Sets the exception policy strategy to use for resolving the OnExceptionDefinition to use for a given thrown exception
 void setFailureProcessor(Processor failureProcessor)
           
 void setHandled(boolean handled)
          Sets the handled using a boolean and thus easier to use for Spring XML configuration as well
 void setHandledPolicy(Predicate handled)
           
 void setLogger(Logger logger)
           
 void setOnRedelivery(Processor onRedelivery)
           
 void setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy)
          Sets the redelivery policy
 void setUseOriginalBody(boolean useOriginalBody)
           
 boolean supportTransacted()
          Whether this error handler supports transacted exchanges.
 String toString()
           
 DeadLetterChannelBuilder useCollisionAvoidance()
           
 DeadLetterChannelBuilder useExponentialBackOff()
           
 DeadLetterChannelBuilder useOriginalBody()
          Will use the original input body when an Exchange is moved to the dead letter queue.
 
Methods inherited from class org.apache.camel.builder.ErrorHandlerBuilderSupport
addErrorHandlers, configure, getErrorHandlers, setErrorHandlers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeadLetterChannelBuilder

public DeadLetterChannelBuilder()
Creates a default DeadLetterChannel with a default endpoint


DeadLetterChannelBuilder

public DeadLetterChannelBuilder(Endpoint deadLetter)
Creates a DeadLetterChannel using the given endpoint

Parameters:
deadLetter - the dead letter queue

DeadLetterChannelBuilder

public DeadLetterChannelBuilder(String uri)
Creates a DeadLetterChannel using the given endpoint

Parameters:
uri - the dead letter queue
Method Detail

createErrorHandler

public Processor createErrorHandler(RouteContext routeContext,
                                    Processor processor)
                             throws Exception
Description copied from interface: ErrorHandlerBuilder
Creates the error handler interceptor

Parameters:
routeContext - the route context
processor - the outer processor
Returns:
the error handler
Throws:
Exception - is thrown if the error handler could not be created

supportTransacted

public boolean supportTransacted()
Description copied from interface: ErrorHandlerBuilder
Whether this error handler supports transacted exchanges.


backOffMultiplier

public DeadLetterChannelBuilder backOffMultiplier(double backOffMultiplier)

collisionAvoidancePercent

public DeadLetterChannelBuilder collisionAvoidancePercent(short collisionAvoidancePercent)

delay

public DeadLetterChannelBuilder delay(long delay)

delayPattern

public DeadLetterChannelBuilder delayPattern(String delayPattern)

maximumRedeliveries

public DeadLetterChannelBuilder maximumRedeliveries(int maximumRedeliveries)

disableRedelivery

public DeadLetterChannelBuilder disableRedelivery()

maximumRedeliveryDelay

public DeadLetterChannelBuilder maximumRedeliveryDelay(long maximumRedeliveryDelay)

useCollisionAvoidance

public DeadLetterChannelBuilder useCollisionAvoidance()

useExponentialBackOff

public DeadLetterChannelBuilder useExponentialBackOff()

retriesExhaustedLogLevel

public DeadLetterChannelBuilder retriesExhaustedLogLevel(LoggingLevel retriesExhaustedLogLevel)

retryAttemptedLogLevel

public DeadLetterChannelBuilder retryAttemptedLogLevel(LoggingLevel retryAttemptedLogLevel)

logStackTrace

public DeadLetterChannelBuilder logStackTrace(boolean logStackTrace)

handled

public DeadLetterChannelBuilder handled(boolean handled)
Sets whether the exchange should be marked as handled or not.

Parameters:
handled - handled or not
Returns:
the builder

handled

public DeadLetterChannelBuilder handled(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 DeadLetterChannelBuilder handled(Expression handled)
Sets whether the exchange should be marked as handled or not.

Parameters:
handled - expression that determines true or false
Returns:
the builder

logger

public DeadLetterChannelBuilder logger(Logger logger)
Sets the logger used for caught exceptions

Parameters:
logger - the logger
Returns:
the builder

loggingLevel

public DeadLetterChannelBuilder loggingLevel(LoggingLevel level)
Sets the logging level of exceptions caught

Parameters:
level - the logging level
Returns:
the builder

log

public DeadLetterChannelBuilder log(org.apache.commons.logging.Log log)
Sets the log used for caught exceptions

Parameters:
log - the logger
Returns:
the builder

log

public DeadLetterChannelBuilder log(String log)
Sets the log used for caught exceptions

Parameters:
log - the log name
Returns:
the builder

log

public DeadLetterChannelBuilder log(Class log)
Sets the log used for caught exceptions

Parameters:
log - the log class
Returns:
the builder

exceptionPolicyStrategy

public DeadLetterChannelBuilder exceptionPolicyStrategy(ExceptionPolicyStrategy exceptionPolicyStrategy)
Sets the exception policy to use

Overrides:
exceptionPolicyStrategy in class ErrorHandlerBuilderSupport
Returns:
the builder

onRedelivery

public DeadLetterChannelBuilder onRedelivery(Processor processor)
Sets a processor that should be processed before a redelivey attempt.

Can be used to change the Exchange before its being redelivered.

Returns:
the builder

useOriginalBody

public DeadLetterChannelBuilder useOriginalBody()
Will use the original input body 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.
Instead of using the current inprogress 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.

Returns:
the builder

getFailureProcessor

public Processor getFailureProcessor()

setFailureProcessor

public void setFailureProcessor(Processor failureProcessor)

getDeadLetterUri

public String getDeadLetterUri()

setDeadLetterUri

public void setDeadLetterUri(String deadLetterUri)

getDeadLetter

public Endpoint getDeadLetter()

setDeadLetter

public void setDeadLetter(Endpoint deadLetter)

getRedeliveryPolicy

public RedeliveryPolicy getRedeliveryPolicy()

setRedeliveryPolicy

public void setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy)
Sets the redelivery policy


getLogger

public Logger getLogger()

setLogger

public void setLogger(Logger logger)

getExceptionPolicyStrategy

public ExceptionPolicyStrategy getExceptionPolicyStrategy()
Sets the exception policy strategy to use for resolving the OnExceptionDefinition to use for a given thrown exception

Specified by:
getExceptionPolicyStrategy in interface ErrorHandlerBuilder
Overrides:
getExceptionPolicyStrategy in class ErrorHandlerBuilderSupport

setExceptionPolicyStrategy

public void setExceptionPolicyStrategy(ExceptionPolicyStrategy exceptionPolicyStrategy)
Description copied from interface: ErrorHandlerBuilder
Sets the exception policy strategy to use for resolving the OnExceptionDefinition to use for a given thrown exception

Specified by:
setExceptionPolicyStrategy in interface ErrorHandlerBuilder
Overrides:
setExceptionPolicyStrategy in class ErrorHandlerBuilderSupport
Parameters:
exceptionPolicyStrategy - the exception policy strategy

getOnRedelivery

public Processor getOnRedelivery()

setOnRedelivery

public void setOnRedelivery(Processor onRedelivery)

getHandledPolicy

public Predicate getHandledPolicy()

setHandledPolicy

public void setHandledPolicy(Predicate handled)

setHandled

public void setHandled(boolean handled)
Sets the handled using a boolean and thus easier to use for Spring XML configuration as well


isUseOriginalBody

public boolean isUseOriginalBody()

setUseOriginalBody

public void setUseOriginalBody(boolean useOriginalBody)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 Apache Software Foundation. All Rights Reserved.