Class RetryTransientErrorsPolicy

java.lang.Object
com.yahoo.messagebus.routing.RetryTransientErrorsPolicy
All Implemented Interfaces:
RetryPolicy

public class RetryTransientErrorsPolicy extends Object implements RetryPolicy
Implements a retry policy that allows resending of any error that is not fatal. It also does progressive back-off, delaying each attempt by the given time multiplied by the retry attempt.
Author:
Simon Thoresen Hult
  • Constructor Details

    • RetryTransientErrorsPolicy

      public RetryTransientErrorsPolicy()
  • Method Details

    • setEnabled

      public RetryTransientErrorsPolicy setEnabled(boolean enabled)
      Sets whether or not this policy should allow retries or not.
      Parameters:
      enabled - True to allow retries.
      Returns:
      This, to allow chaining.
    • setBaseDelay

      public RetryTransientErrorsPolicy setBaseDelay(double baseDelay)
      Sets the base delay in seconds to wait between retries. This amount is multiplied by the retry number.
      Parameters:
      baseDelay - The time in seconds.
      Returns:
      This, to allow chaining.
    • canRetry

      public boolean canRetry(int errorCode)
      Description copied from interface: RetryPolicy
      Returns whether or not a Reply containing an Error with the given error code can be retried. This method is invoked once for each error in a reply.
      Specified by:
      canRetry in interface RetryPolicy
      Parameters:
      errorCode - The code to check.
      Returns:
      True if the message can be resent.
    • getRetryDelay

      public double getRetryDelay(int retry)
      Description copied from interface: RetryPolicy
      Returns the number of seconds to delay resending a message.
      Specified by:
      getRetryDelay in interface RetryPolicy
      Parameters:
      retry - The retry attempt.
      Returns:
      The delay in seconds.