Class RetryEventDeliveryExceptionHandler

    • Constructor Detail

      • RetryEventDeliveryExceptionHandler

        public RetryEventDeliveryExceptionHandler​(EventuateClientScheduler eventuateClientScheduler)
        Creates a RetryEventDeliveryExceptionHandler that uses the specified scheduler
        Parameters:
        eventuateClientScheduler - the scheduler
    • Method Detail

      • handle

        public 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
        Specified by:
        handle in interface EventDeliveryExceptionHandler
        Parameters:
        state - the state
        t - the throwable
        retry - invoked asynchronously to retry
        fail - invoked asynchronously to fail
        ignore -
      • withExceptions

        @SafeVarargs
        public final RetryEventDeliveryExceptionHandler withExceptions​(java.lang.Class<? extends java.lang.Throwable>... throwables)
        Specifies the exceptions that this exception handler can handle
        Parameters:
        throwables - the exceptions
        Returns:
        this
      • withMaxRetries

        public RetryEventDeliveryExceptionHandler withMaxRetries​(int numberOfRetries)
        Specifies the maximum number of retries
        Parameters:
        numberOfRetries - number of retries to attempt
        Returns:
        this
      • withRetryInterval

        public RetryEventDeliveryExceptionHandler withRetryInterval​(java.time.Duration retryInterval)
        Specifies the interval between retries
        Parameters:
        retryInterval - the retry interval
        Returns:
        this