public class TransactionErrorHandler
extends org.apache.camel.processor.ErrorHandlerSupport
implements org.apache.camel.AsyncProcessor, org.apache.camel.spi.ShutdownPrepared, org.apache.camel.Navigate<org.apache.camel.Processor>
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.Modifier and Type | Field and Description |
---|---|
protected org.apache.camel.Processor |
output |
protected boolean |
preparingShutdown |
Constructor and Description |
---|
TransactionErrorHandler(org.apache.camel.CamelContext camelContext,
org.apache.camel.Processor output,
org.apache.camel.processor.exceptionpolicy.ExceptionPolicyStrategy exceptionPolicyStrategy,
JtaTransactionPolicy transactionPolicy,
ScheduledExecutorService executorService,
org.apache.camel.LoggingLevel rollbackLoggingLevel)
Creates the transaction error handler.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doInTransactionTemplate(org.apache.camel.Exchange exchange) |
protected void |
doShutdown() |
protected void |
doStart() |
protected void |
doStop() |
org.apache.camel.processor.exceptionpolicy.ExceptionPolicyStrategy |
getExceptionPolicy() |
org.apache.camel.Processor |
getOutput() |
boolean |
hasNext() |
List<org.apache.camel.Processor> |
next() |
void |
prepareShutdown(boolean suspendOnly,
boolean forced) |
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 the
Exchange using the error handler. |
protected void |
processInTransaction(org.apache.camel.Exchange exchange) |
void |
setExceptionPolicy(org.apache.camel.processor.exceptionpolicy.ExceptionPolicyStrategy exceptionPolicy) |
void |
setTransactionPolicy(JtaTransactionPolicy transactionPolicy) |
boolean |
supportTransacted() |
addExceptionPolicy, createDefaultExceptionPolicyStrategy, getExceptionPolicy, isDeadLetterChannel
addChildService, removeChildService, shutdown, start, start, stop
protected final org.apache.camel.Processor output
protected volatile boolean preparingShutdown
public TransactionErrorHandler(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor output, org.apache.camel.processor.exceptionpolicy.ExceptionPolicyStrategy exceptionPolicyStrategy, JtaTransactionPolicy transactionPolicy, ScheduledExecutorService executorService, org.apache.camel.LoggingLevel rollbackLoggingLevel)
camelContext
- the camel contextoutput
- outer processor that should use this default error handlerexceptionPolicyStrategy
- strategy for onException handlingtransactionPolicy
- the transaction policyexecutorService
- the ScheduledExecutorService
to
be used for redelivery thread pool. Can be null.rollbackLoggingLevel
- logging level to use for logging transaction rollback occurredpublic void process(org.apache.camel.Exchange exchange) throws Exception
process
in interface org.apache.camel.Processor
Exception
public boolean process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)
process
in interface org.apache.camel.AsyncProcessor
protected void processInTransaction(org.apache.camel.Exchange exchange) throws Exception
Exception
public void setTransactionPolicy(JtaTransactionPolicy transactionPolicy)
protected void doInTransactionTemplate(org.apache.camel.Exchange exchange) throws Throwable
Throwable
protected void processByErrorHandler(org.apache.camel.Exchange exchange)
Exchange
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.exchange
- the exchangepublic void setExceptionPolicy(org.apache.camel.processor.exceptionpolicy.ExceptionPolicyStrategy exceptionPolicy)
setExceptionPolicy
in class org.apache.camel.processor.ErrorHandlerSupport
public org.apache.camel.processor.exceptionpolicy.ExceptionPolicyStrategy getExceptionPolicy()
public org.apache.camel.Processor getOutput()
getOutput
in class org.apache.camel.processor.ErrorHandlerSupport
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.ServiceSupport
Exception
protected void doShutdown() throws Exception
doShutdown
in class org.apache.camel.support.ServiceSupport
Exception
public boolean supportTransacted()
supportTransacted
in class org.apache.camel.processor.ErrorHandlerSupport
public boolean hasNext()
hasNext
in interface org.apache.camel.Navigate<org.apache.camel.Processor>
public List<org.apache.camel.Processor> next()
next
in interface org.apache.camel.Navigate<org.apache.camel.Processor>
public void prepareShutdown(boolean suspendOnly, boolean forced)
prepareShutdown
in interface org.apache.camel.spi.ShutdownPrepared
Apache Camel