Package org.apache.camel.jta
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.jta.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.ShutdownPrepared,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
public class TransactionErrorHandler extends org.apache.camel.processor.errorhandler.ErrorHandlerSupport implements org.apache.camel.AsyncProcessor, org.apache.camel.spi.ShutdownPrepared, org.apache.camel.Navigate<org.apache.camel.Processor>Does transactional execution according given policy. This class is based on org.apache.camel.spring.spi.TransactionErrorHandler excluding redelivery functionality. In the Spring implementation redelivering is done within the transaction which is not appropriate in JTA since every error breaks the current transaction.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.camel.CamelContextcamelContextprotected org.apache.camel.Processoroutputprotected booleanpreparingShutdown
-
Constructor Summary
Constructors Constructor Description TransactionErrorHandler(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor output, JtaTransactionPolicy transactionPolicy, org.apache.camel.LoggingLevel rollbackLoggingLevel)Creates the transaction error handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.camel.spi.ErrorHandlerclone(org.apache.camel.Processor output)protected voiddoInTransactionTemplate(org.apache.camel.Exchange exchange)protected voiddoShutdown()protected voiddoStart()protected voiddoStop()org.apache.camel.ProcessorgetOutput()booleanhasNext()List<org.apache.camel.Processor>next()voidprepareShutdown(boolean suspendOnly, boolean forced)voidprocess(org.apache.camel.Exchange exchange)booleanprocess(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)CompletableFuture<org.apache.camel.Exchange>processAsync(org.apache.camel.Exchange exchange)protected voidprocessByErrorHandler(org.apache.camel.Exchange exchange)Processes theExchangeusing the error handler.protected voidprocessInTransaction(org.apache.camel.Exchange exchange)voidsetTransactionPolicy(JtaTransactionPolicy transactionPolicy)booleansupportTransacted()-
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, doSuspend, fail, 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, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
TransactionErrorHandler
public TransactionErrorHandler(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor output, JtaTransactionPolicy transactionPolicy, org.apache.camel.LoggingLevel rollbackLoggingLevel)Creates the transaction error handler.- Parameters:
camelContext- the camel contextoutput- outer processor that should use this default error handlertransactionPolicy- the transaction policyrollbackLoggingLevel- logging level to use for logging transaction rollback occurred
-
-
Method Detail
-
clone
public org.apache.camel.spi.ErrorHandler clone(org.apache.camel.Processor output)
- Specified by:
clonein classorg.apache.camel.processor.errorhandler.ErrorHandlerSupport
-
process
public void process(org.apache.camel.Exchange exchange) throws Exception- Specified by:
processin interfaceorg.apache.camel.Processor- Throws:
Exception
-
process
public boolean process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)- Specified by:
processin interfaceorg.apache.camel.AsyncProcessor
-
processAsync
public CompletableFuture<org.apache.camel.Exchange> processAsync(org.apache.camel.Exchange exchange)
- Specified by:
processAsyncin interfaceorg.apache.camel.AsyncProcessor
-
processInTransaction
protected void processInTransaction(org.apache.camel.Exchange exchange)
-
setTransactionPolicy
public void setTransactionPolicy(JtaTransactionPolicy transactionPolicy)
-
doInTransactionTemplate
protected void doInTransactionTemplate(org.apache.camel.Exchange exchange) throws Throwable- Throws:
Throwable
-
processByErrorHandler
protected void processByErrorHandler(org.apache.camel.Exchange exchange)
Processes theExchangeusing 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
-
getOutput
public org.apache.camel.Processor getOutput()
- Specified by:
getOutputin classorg.apache.camel.processor.errorhandler.ErrorHandlerSupport
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doShutdown
protected void doShutdown() throws Exception- Overrides:
doShutdownin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
supportTransacted
public boolean supportTransacted()
- Specified by:
supportTransactedin classorg.apache.camel.processor.errorhandler.ErrorHandlerSupport
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceorg.apache.camel.Navigate<org.apache.camel.Processor>
-
next
public List<org.apache.camel.Processor> next()
- Specified by:
nextin interfaceorg.apache.camel.Navigate<org.apache.camel.Processor>
-
prepareShutdown
public void prepareShutdown(boolean suspendOnly, boolean forced)- Specified by:
prepareShutdownin interfaceorg.apache.camel.spi.ShutdownPrepared
-
-