Interface RetryScheduler

All Known Implementing Classes:
AbstractRetryScheduler, ExponentialBackOffIntervalRetryScheduler, IntervalRetryScheduler

public interface RetryScheduler
Interface towards a mechanism that decides whether to schedule a command for execution when a previous attempts resulted in an exception.
Since:
2.0
Author:
Allard Buijze
  • Method Details

    • scheduleRetry

      boolean scheduleRetry(@Nonnull CommandMessage commandMessage, @Nonnull RuntimeException lastFailure, @Nonnull List<Class<? extends Throwable>[]> failures, @Nonnull Runnable commandDispatch)
      Inspect the given commandMessage that failed with given lastFailure. The given failures provides a list of previous failures known for this command. The commandDispatch task can be used to schedule the command for dispatching.

      The return value of this method indicates whether the command has been scheduled for a retry. When true, the original callbacks should not be invoked, as command execution is subject to a retry. When false, the failure is interpreted as terminal and the callback will be invoked with the last failure recorded.

      If the implementation throws an Exception, that exception is passed as the failure to the original callback.

      Parameters:
      commandMessage - The Command Message being dispatched
      lastFailure - The last failure recorded for this command
      failures - A condensed view of all known failures of this command. Each element in the array represents the cause of the element preceding it.
      commandDispatch - The task to be executed to retry a command
      Returns:
      true if the command has been rescheduled, otherwise false