Package org.apache.camel.spring.spi
Class TransactionErrorHandler
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.ChildServiceSupport
org.apache.camel.processor.errorhandler.ErrorHandlerSupport
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler
org.apache.camel.spring.spi.TransactionErrorHandler
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.AsyncProcessor
,org.apache.camel.Navigate<org.apache.camel.Processor>
,org.apache.camel.Processor
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.ErrorHandler
,org.apache.camel.spi.ErrorHandlerRedeliveryCustomizer
,org.apache.camel.spi.ShutdownPrepared
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
public class TransactionErrorHandler
extends org.apache.camel.processor.errorhandler.RedeliveryErrorHandler
The Transactional Client EIP pattern.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.camel.processor.errorhandler.RedeliveryErrorHandler
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler.RedeliveryTask, org.apache.camel.processor.errorhandler.RedeliveryErrorHandler.SimpleTask
-
Field Summary
Fields inherited from class org.apache.camel.processor.errorhandler.RedeliveryErrorHandler
awaitManager, camelContext, customExchangeFormatter, deadLetter, deadLetterHandleNewException, deadLetterUri, exchangeFormatter, executorService, logger, onExceptionProcessor, onPrepareProcessor, output, outputAsync, preparingShutdown, reactiveExecutor, redeliveryEnabled, redeliveryPolicy, redeliveryProcessor, redeliverySleepCounter, retryWhilePolicy, shutdownStrategy, simpleTask, taskFactory, useOriginalBodyPolicy, useOriginalMessagePolicy
Fields inherited from class org.apache.camel.processor.errorhandler.ErrorHandlerSupport
DEFAULT_EXCHANGE_FORMATTER, exceptionPolicies, exceptionPolicy
Fields inherited from class org.apache.camel.support.ChildServiceSupport
childServices
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
-
Constructor Summary
ConstructorsConstructorDescriptionTransactionErrorHandler
(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor output, org.apache.camel.spi.CamelLogger logger, org.apache.camel.Processor redeliveryProcessor, org.apache.camel.processor.errorhandler.RedeliveryPolicy redeliveryPolicy, org.springframework.transaction.support.TransactionTemplate transactionTemplate, org.apache.camel.Predicate retryWhile, ScheduledExecutorService executorService, org.apache.camel.LoggingLevel rollbackLoggingLevel, org.apache.camel.Processor onExceptionOccurredProcessor) Creates the transaction error handler. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.spi.ErrorHandler
clone
(org.apache.camel.Processor output) protected void
doInTransactionTemplate
(org.apache.camel.Exchange exchange) void
process
(org.apache.camel.Exchange exchange) boolean
process
(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) protected void
processByErrorHandler
(org.apache.camel.Exchange exchange) Processes theExchange
using the error handler.protected void
processInTransaction
(org.apache.camel.Exchange exchange) boolean
toString()
Methods inherited from class org.apache.camel.processor.errorhandler.RedeliveryErrorHandler
changeOutput, defensiveCopyExchangeIfNeeded, determineIfRedeliveryIsEnabled, determineRedeliveryDelay, doShutdown, doStart, getDeadLetter, getDeadLetterUri, getDefaultHandledPredicate, getLogger, getOutput, getRedeliveryPolicy, hasNext, isDeadLetterHandleNewException, isDone, isRunAllowedOnPreparingShutdown, isUseOriginalBodyPolicy, isUseOriginalMessagePolicy, next, prepareShutdown, processAsync
Methods inherited from class org.apache.camel.processor.errorhandler.ErrorHandlerSupport
addErrorHandler, addExceptionPolicy, getExceptionPolicy, isDeadLetterChannel
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, doStop, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, suspend
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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 Details
-
TransactionErrorHandler
public TransactionErrorHandler(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor output, org.apache.camel.spi.CamelLogger logger, org.apache.camel.Processor redeliveryProcessor, org.apache.camel.processor.errorhandler.RedeliveryPolicy redeliveryPolicy, org.springframework.transaction.support.TransactionTemplate transactionTemplate, org.apache.camel.Predicate retryWhile, ScheduledExecutorService executorService, org.apache.camel.LoggingLevel rollbackLoggingLevel, org.apache.camel.Processor onExceptionOccurredProcessor) Creates the transaction error handler.- Parameters:
camelContext
- the camel contextoutput
- outer processor that should use this default error handlerlogger
- logger to use for logging failures and redelivery attemptsredeliveryProcessor
- an optional processor to run before redelivery attemptredeliveryPolicy
- policy for redeliverytransactionTemplate
- the transaction templateretryWhile
- retry whileexecutorService
- theScheduledExecutorService
to be used for redelivery thread pool. Can be null.rollbackLoggingLevel
- logging level to use for logging transaction rollback occurredonExceptionOccurredProcessor
- a customProcessor
to process theExchange
just after an exception was thrown.
-
-
Method Details
-
clone
public org.apache.camel.spi.ErrorHandler clone(org.apache.camel.Processor output) - Specified by:
clone
in classorg.apache.camel.processor.errorhandler.ErrorHandlerSupport
-
supportTransacted
public boolean supportTransacted()- Overrides:
supportTransacted
in classorg.apache.camel.processor.errorhandler.RedeliveryErrorHandler
-
toString
-
process
public void process(org.apache.camel.Exchange exchange) - Specified by:
process
in interfaceorg.apache.camel.Processor
- Overrides:
process
in classorg.apache.camel.processor.errorhandler.RedeliveryErrorHandler
-
process
public boolean process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) - Specified by:
process
in interfaceorg.apache.camel.AsyncProcessor
- Overrides:
process
in classorg.apache.camel.processor.errorhandler.RedeliveryErrorHandler
-
processInTransaction
protected void processInTransaction(org.apache.camel.Exchange exchange) -
doInTransactionTemplate
protected void doInTransactionTemplate(org.apache.camel.Exchange exchange) -
processByErrorHandler
protected void processByErrorHandler(org.apache.camel.Exchange exchange) Processes theExchange
using the error handler. This implementation will invoke ensure this occurs synchronously, that means if the async routing engine did kick in, then this implementation will wait for the task to complete before it continues.- Parameters:
exchange
- the exchange
-