Interface RetryScheduler

All Known Implementing Classes:
AsyncRetryScheduler

public interface RetryScheduler
Interface towards a mechanism that decides whether to schedule a message for dispatching when a previous attempts failed.
Since:
2.0
Author:
Allard Buijze
  • Method Details

    • scheduleRetry

      <M extends Message, R extends Message> MessageStream<R> scheduleRetry(@Nonnull M message, @Nullable ProcessingContext processingContext, @Nonnull Throwable cause, @Nonnull RetryScheduler.Dispatcher<M,R> dispatcher)
      Schedules the given message to retry dispatching using the given dispatching function.

      Implementations may execute the retries immediately or schedule them later retry. The returned MessageStream may complete after several retry attempts or immediately, depending on whether retries are configured or if the cause indicates that a retry could possibly provide a different outcome.

      If the scheduler determines that a retry can not lead to a different outcome, it must return immediately with a failed MessageStream holding the original given cause as its failure.

      Type Parameters:
      M - The type of message to (re)dispatch
      R - The type of message expected as a result of dispatching
      Parameters:
      message - The Message being dispatched
      processingContext - The context under which the message is dispatched
      cause - The cause of the failure.
      dispatcher - The function to execute individual retries
      Returns:
      a MessageStream representing the result of the last attempt