Class ErrorHandlerSupport

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.Processor, ErrorHandler, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.StatefulService, org.apache.camel.SuspendableService
    Direct Known Subclasses:
    RedeliveryErrorHandler

    public abstract class ErrorHandlerSupport
    extends org.apache.camel.support.ChildServiceSupport
    implements ErrorHandler
    Support class for ErrorHandler implementations.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Map<ExceptionPolicyKey,​ExceptionPolicy> exceptionPolicies  
      protected ExceptionPolicyStrategy exceptionPolicy  
      • Fields inherited from class org.apache.camel.support.ChildServiceSupport

        childServices
      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILDED, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTINGDOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addErrorHandler​(org.apache.camel.Processor errorHandler)  
      void addExceptionPolicy​(ExceptionPolicyKey key, ExceptionPolicy policy)  
      static ExceptionPolicyStrategy createDefaultExceptionPolicyStrategy()
      Creates the default exception policy strategy to use.
      protected ExceptionPolicy getExceptionPolicy​(org.apache.camel.Exchange exchange, Throwable exception)
      CamelContextHelper Attempts to find the best suited ExceptionPolicy to be used for handling the given thrown exception.
      abstract org.apache.camel.Processor getOutput()
      Gets the output
      boolean isDeadLetterChannel()
      Whether this error handler handles exhausted errors by moving the exchange to a dead letter channel.
      void setExceptionPolicy​(ExceptionPolicyStrategy exceptionPolicy)
      Sets the strategy to use for resolving the ExceptionPolicy to use for handling thrown exceptions.
      abstract boolean supportTransacted()
      Whether this error handler supports transacted exchanges or not.
      • Methods inherited from class org.apache.camel.support.ChildServiceSupport

        addChildService, removeChildService, shutdown, start, stop
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, suspend
      • Methods inherited from interface org.apache.camel.Processor

        process
      • Methods inherited from interface org.apache.camel.Service

        build, close, init
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Constructor Detail

      • ErrorHandlerSupport

        public ErrorHandlerSupport()
    • Method Detail

      • addErrorHandler

        public void addErrorHandler​(org.apache.camel.Processor errorHandler)
      • getExceptionPolicy

        protected ExceptionPolicy getExceptionPolicy​(org.apache.camel.Exchange exchange,
                                                     Throwable exception)
        CamelContextHelper Attempts to find the best suited ExceptionPolicy to be used for handling the given thrown exception.
        Parameters:
        exchange - the exchange
        exception - the exception that was thrown
        Returns:
        the best exception type to handle this exception, null if none found.
      • setExceptionPolicy

        public void setExceptionPolicy​(ExceptionPolicyStrategy exceptionPolicy)
        Sets the strategy to use for resolving the ExceptionPolicy to use for handling thrown exceptions.
      • createDefaultExceptionPolicyStrategy

        public static ExceptionPolicyStrategy createDefaultExceptionPolicyStrategy()
        Creates the default exception policy strategy to use.
      • supportTransacted

        public abstract boolean supportTransacted()
        Whether this error handler supports transacted exchanges or not.
      • isDeadLetterChannel

        public boolean isDeadLetterChannel()
        Whether this error handler handles exhausted errors by moving the exchange to a dead letter channel.
      • getOutput

        public abstract org.apache.camel.Processor getOutput()
        Gets the output