public class RetryEventDeliveryExceptionHandler extends java.lang.Object implements EventDeliveryExceptionHandler
| Constructor and Description |
|---|
RetryEventDeliveryExceptionHandler(EventuateClientScheduler eventuateClientScheduler)
Creates a RetryEventDeliveryExceptionHandler that uses the specified scheduler
|
| Modifier and Type | Method and Description |
|---|---|
void |
handle(EventDeliveryExceptionHandlerState state,
java.lang.Throwable t,
java.lang.Runnable retry,
java.util.function.Consumer<java.lang.Throwable> fail,
java.lang.Runnable ignore)
Retry after the timeout unless the max retries has been exceeded or the supplied throwable is not handled
|
boolean |
handles(java.lang.Throwable t)
Returns true if this handles the throwable
|
EventDeliveryExceptionHandlerState |
makeState(java.lang.Throwable t)
create the state used for handling an exception
|
RetryEventDeliveryExceptionHandler |
withExceptions(java.lang.Class<? extends java.lang.Throwable>... throwables)
Specifies the exceptions that this exception handler can handle
|
RetryEventDeliveryExceptionHandler |
withInfiniteRetries()
Specifies an infinite number of retries
|
RetryEventDeliveryExceptionHandler |
withMaxRetries(int numberOfRetries)
Specifies the maximum number of retries
|
RetryEventDeliveryExceptionHandler |
withRetryInterval(java.time.Duration retryInterval)
Specifies the interval between retries
|
public RetryEventDeliveryExceptionHandler(EventuateClientScheduler eventuateClientScheduler)
eventuateClientScheduler - the schedulerpublic boolean handles(java.lang.Throwable t)
EventDeliveryExceptionHandlerhandles in interface EventDeliveryExceptionHandlert - the throwablepublic EventDeliveryExceptionHandlerState makeState(java.lang.Throwable t)
EventDeliveryExceptionHandlermakeState in interface EventDeliveryExceptionHandlert - the throwablepublic void handle(EventDeliveryExceptionHandlerState state, java.lang.Throwable t, java.lang.Runnable retry, java.util.function.Consumer<java.lang.Throwable> fail, java.lang.Runnable ignore)
handle in interface EventDeliveryExceptionHandlerstate - the statet - the throwableretry - invoked asynchronously to retryfail - invoked asynchronously to failignore - @SafeVarargs public final RetryEventDeliveryExceptionHandler withExceptions(java.lang.Class<? extends java.lang.Throwable>... throwables)
throwables - the exceptionspublic RetryEventDeliveryExceptionHandler withMaxRetries(int numberOfRetries)
numberOfRetries - number of retries to attemptpublic RetryEventDeliveryExceptionHandler withInfiniteRetries()
public RetryEventDeliveryExceptionHandler withRetryInterval(java.time.Duration retryInterval)
retryInterval - the retry interval