Package com.adaptris.core
Class RetryMessageErrorHandlerImp
- java.lang.Object
-
- com.adaptris.core.RootProcessingExceptionHandler
-
- com.adaptris.core.StandardProcessingExceptionHandler
-
- com.adaptris.core.RetryMessageErrorHandlerImp
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,ErrorHandlerRegistrar,EventHandlerAware,ProcessingExceptionHandler,StateManagedComponent
- Direct Known Subclasses:
RetryMessageErrorHandler
public abstract class RetryMessageErrorHandlerImp extends StandardProcessingExceptionHandler
Abstract MessageErrorHandler implementation that allows automatic retries for a problem message.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classRetryMessageErrorHandlerImp.RetryThreadPrivate thread used to resubmit messages.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ScheduledExecutorServiceexecutorprotected java.util.List<AdaptrisMessage>inProgressprotected static java.lang.StringIS_RETRY_KEYprotected static java.lang.StringRETRY_COUNT_KEYprotected java.util.List<AdaptrisMessage>retryList-
Fields inherited from class com.adaptris.core.RootProcessingExceptionHandler
log
-
-
Constructor Summary
Constructors Constructor Description RetryMessageErrorHandlerImp()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidfailAllMessages()protected voidfailFutureMessages(boolean failFuture)protected voidfailMessage(AdaptrisMessage msg)protected voidfailMessage(java.lang.String s)protected static java.util.Map<java.lang.String,Workflow>filterStarted(java.util.Map<java.lang.String,Workflow> workflows)TimeIntervalgetRetryInterval()java.lang.IntegergetRetryLimit()Get the retry limit.voidhandleProcessingException(AdaptrisMessage msg)Handles error messages from Workflows by sending them to the configured error producer.protected voidscheduleNextRun(AdaptrisMessage msg)voidsetRetryInterval(TimeInterval interval)Set the interval between attempts to retry a failed message.voidsetRetryLimit(java.lang.Integer i)Set the limit on the number of retries that a message may have.voidstart()Starts the component.voidstop()Stop the componentprotected java.util.Collection<java.lang.String>waitingForRetry()-
Methods inherited from class com.adaptris.core.StandardProcessingExceptionHandler
close, getProcessingExceptionService, hasConfiguredBehaviour, init, logErrorMessage, prepare, registeredWorkflows, registerEventHandler, registerWorkflow, setProcessingExceptionService
-
Methods inherited from class com.adaptris.core.RootProcessingExceptionHandler
changeState, getAlwaysHandleException, getParent, getUniqueId, notifyParent, onChildError, registerDigester, registerParent, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveDigester, setAlwaysHandleException, setUniqueId
-
-
-
-
Field Detail
-
IS_RETRY_KEY
protected static final java.lang.String IS_RETRY_KEY
- See Also:
- Constant Field Values
-
RETRY_COUNT_KEY
protected static final java.lang.String RETRY_COUNT_KEY
- See Also:
- Constant Field Values
-
executor
protected transient java.util.concurrent.ScheduledExecutorService executor
-
retryList
protected transient java.util.List<AdaptrisMessage> retryList
-
inProgress
protected transient java.util.List<AdaptrisMessage> inProgress
-
-
Method Detail
-
handleProcessingException
public void handleProcessingException(AdaptrisMessage msg)
Description copied from class:StandardProcessingExceptionHandlerHandles error messages from Workflows by sending them to the configured error producer. The best practice would be for the service to write the message to the filesystem, which is pretty unlikely to fail.
- Specified by:
handleProcessingExceptionin interfaceProcessingExceptionHandler- Overrides:
handleProcessingExceptionin classStandardProcessingExceptionHandler- Parameters:
msg- theAdaptrisMessageto handle
-
start
public void start() throws CoreExceptionDescription copied from interface:ComponentLifecycleStarts the component.Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer, calling start will begin message delivery.- Specified by:
startin interfaceComponentLifecycle- Overrides:
startin classStandardProcessingExceptionHandler- Throws:
CoreException- wrapping any underlyingExceptions
-
stop
public void stop()
Description copied from interface:ComponentLifecycleStop the componentA stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer, calling stop will pause message delivery. Throwing aRuntimeExceptionmay cause unintended consequences- Specified by:
stopin interfaceComponentLifecycle- Overrides:
stopin classStandardProcessingExceptionHandler
-
setRetryLimit
public void setRetryLimit(java.lang.Integer i)
Set the limit on the number of retries that a message may have.- Parameters:
i- the number of retries, if less than or equal to 0, then this is considered to be an infinite number of retries.
-
getRetryLimit
public java.lang.Integer getRetryLimit()
Get the retry limit.- Returns:
- the retry limit.
-
getRetryInterval
public TimeInterval getRetryInterval()
-
setRetryInterval
public void setRetryInterval(TimeInterval interval)
Set the interval between attempts to retry a failed message.- Parameters:
interval- the interval; default is 10 minutes if not explicitly configured.
-
failAllMessages
protected void failAllMessages()
-
failFutureMessages
protected void failFutureMessages(boolean failFuture)
-
waitingForRetry
protected java.util.Collection<java.lang.String> waitingForRetry()
-
failMessage
protected void failMessage(java.lang.String s)
-
failMessage
protected void failMessage(AdaptrisMessage msg)
-
scheduleNextRun
protected void scheduleNextRun(AdaptrisMessage msg)
-
-