|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.impl.ServiceSupport org.apache.camel.processor.ErrorHandlerSupport org.apache.camel.processor.RedeliveryErrorHandler
public abstract class RedeliveryErrorHandler
Base redeliverable error handler that also supports a final dead letter queue in case all redelivery attempts fail.
This implementation should contain all the error handling logic and the sub classes should only configure it according to what they support.
Nested Class Summary | |
---|---|
protected class |
RedeliveryErrorHandler.RedeliveryData
Contains the current redelivery data |
Field Summary | |
---|---|
protected CamelContext |
camelContext
|
protected Processor |
deadLetter
|
protected String |
deadLetterUri
|
protected Predicate |
handledPolicy
|
protected Logger |
logger
|
protected Processor |
output
|
protected AsyncProcessor |
outputAsync
|
protected RedeliveryPolicy |
redeliveryPolicy
|
protected Processor |
redeliveryProcessor
|
protected Predicate |
retryWhilePolicy
|
protected boolean |
useOriginalMessagePolicy
|
Fields inherited from class org.apache.camel.processor.ErrorHandlerSupport |
---|
log |
Constructor Summary | |
---|---|
RedeliveryErrorHandler(CamelContext camelContext,
Processor output,
Logger logger,
Processor redeliveryProcessor,
RedeliveryPolicy redeliveryPolicy,
Predicate handledPolicy,
Processor deadLetter,
String deadLetterUri,
boolean useOriginalMessagePolicy,
Predicate retryWhile)
|
Method Summary | |
---|---|
protected boolean |
deliverToFailureProcessor(Processor processor,
Exchange exchange,
RedeliveryErrorHandler.RedeliveryData data,
AsyncCallback callback)
All redelivery attempts failed so move the exchange to the dead letter queue |
protected void |
deliverToOnRedeliveryProcessor(Exchange exchange,
RedeliveryErrorHandler.RedeliveryData data)
Gives an optional configure redelivery processor a chance to process before the Exchange will be redelivered. |
protected void |
doStart()
|
protected void |
doStop()
|
Processor |
getDeadLetter()
Returns the dead letter that message exchanges will be sent to if the redelivery attempts fail |
String |
getDeadLetterUri()
|
Logger |
getLogger()
|
Processor |
getOutput()
Returns the output processor |
RedeliveryPolicy |
getRedeliveryPolicy()
|
protected void |
handleException(Exchange exchange,
RedeliveryErrorHandler.RedeliveryData data)
|
protected boolean |
isCancelledOrInterrupted(Exchange exchange)
Strategy to determine if the exchange was cancelled or interrupted |
protected boolean |
isDone(Exchange exchange)
Strategy to determine if the exchange is done so we can continue |
boolean |
isUseOriginalMessagePolicy()
|
protected void |
prepareExchangeAfterFailure(Exchange exchange,
RedeliveryErrorHandler.RedeliveryData data)
|
protected void |
prepareExchangeForContinue(Exchange exchange,
RedeliveryErrorHandler.RedeliveryData data)
|
protected void |
prepareExchangeForRedelivery(Exchange exchange)
|
void |
process(Exchange exchange)
Processes the message exchange |
boolean |
process(Exchange exchange,
AsyncCallback callback)
Processes the message exchange. |
protected void |
processAsyncErrorHandler(Exchange exchange,
AsyncCallback callback,
RedeliveryErrorHandler.RedeliveryData data)
This logic is only executed if we have to retry redelivery asynchronously, which have to be done from the callback. |
protected boolean |
processErrorHandler(Exchange exchange,
AsyncCallback callback,
RedeliveryErrorHandler.RedeliveryData data)
Process the exchange using redelivery error handling. |
protected boolean |
shouldHandleException(Exchange exchange)
Strategy whether the exchange has an exception that we should try to handle. |
boolean |
supportTransacted()
Whether this error handler supports transacted exchanges or not. |
Methods inherited from class org.apache.camel.processor.ErrorHandlerSupport |
---|
addExceptionPolicy, createDefaultExceptionPolicyStrategy, customProcessorForException, getExceptionPolicy, setExceptionPolicy |
Methods inherited from class org.apache.camel.impl.ServiceSupport |
---|
addChildService, doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final CamelContext camelContext
protected final Processor deadLetter
protected final String deadLetterUri
protected final Processor output
protected final AsyncProcessor outputAsync
protected final Processor redeliveryProcessor
protected final RedeliveryPolicy redeliveryPolicy
protected final Predicate handledPolicy
protected final Predicate retryWhilePolicy
protected final Logger logger
protected final boolean useOriginalMessagePolicy
Constructor Detail |
---|
public RedeliveryErrorHandler(CamelContext camelContext, Processor output, Logger logger, Processor redeliveryProcessor, RedeliveryPolicy redeliveryPolicy, Predicate handledPolicy, Processor deadLetter, String deadLetterUri, boolean useOriginalMessagePolicy, Predicate retryWhile)
Method Detail |
---|
public boolean supportTransacted()
ErrorHandlerSupport
supportTransacted
in class ErrorHandlerSupport
public void process(Exchange exchange) throws Exception
Processor
process
in interface Processor
exchange
- the message exchange
Exception
- if an internal processing error has occurred.public boolean process(Exchange exchange, AsyncCallback callback)
AsyncProcessor
Processor.process(org.apache.camel.Exchange)
, but the caller supports having the exchange asynchronously processed.
If there was a failure processing then the caused Exception
would be set on the Exchange
.
process
in interface AsyncProcessor
exchange
- the message exchangecallback
- the AsyncCallback
will be invoked when the processing of the exchange is completed.
If the exchange is completed synchronously, then the callback is also invoked synchronously.
The callback should therefore be careful of starting recursive loop.
AsyncProcessorHelper.process(AsyncProcessor, Exchange, AsyncCallback)
protected boolean processErrorHandler(Exchange exchange, AsyncCallback callback, RedeliveryErrorHandler.RedeliveryData data)
protected void processAsyncErrorHandler(Exchange exchange, AsyncCallback callback, RedeliveryErrorHandler.RedeliveryData data)
protected boolean shouldHandleException(Exchange exchange)
protected boolean isDone(Exchange exchange)
protected boolean isCancelledOrInterrupted(Exchange exchange)
public Processor getOutput()
getOutput
in class ErrorHandlerSupport
public Processor getDeadLetter()
public String getDeadLetterUri()
public boolean isUseOriginalMessagePolicy()
public RedeliveryPolicy getRedeliveryPolicy()
public Logger getLogger()
protected void prepareExchangeForContinue(Exchange exchange, RedeliveryErrorHandler.RedeliveryData data)
protected void prepareExchangeForRedelivery(Exchange exchange)
protected void handleException(Exchange exchange, RedeliveryErrorHandler.RedeliveryData data)
protected void deliverToOnRedeliveryProcessor(Exchange exchange, RedeliveryErrorHandler.RedeliveryData data)
protected boolean deliverToFailureProcessor(Processor processor, Exchange exchange, RedeliveryErrorHandler.RedeliveryData data, AsyncCallback callback)
protected void prepareExchangeAfterFailure(Exchange exchange, RedeliveryErrorHandler.RedeliveryData data)
protected void doStart() throws Exception
doStart
in class ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class ServiceSupport
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |