Class RetryConfig

java.lang.Object
io.github.resilience4j.retry.RetryConfig
All Implemented Interfaces:
Serializable

public class RetryConfig extends Object implements Serializable
See Also:
  • Field Details

  • Method Details

    • custom

      public static <T> RetryConfig.Builder<T> custom()
      Returns a builder to create a custom RetryConfig.
      Type Parameters:
      T - The type being built.
      Returns:
      a RetryConfig.Builder
    • from

      public static <T> RetryConfig.Builder<T> from(RetryConfig baseConfig)
    • ofDefaults

      public static RetryConfig ofDefaults()
      Creates a default Retry configuration.
      Returns:
      a default Retry configuration.
    • getMaxAttempts

      public int getMaxAttempts()
      Returns:
      the maximum allowed attempts to make.
    • isFailAfterMaxAttempts

      public boolean isFailAfterMaxAttempts()
      Returns:
      if exception should be thrown after max attempts are made with no satisfactory result
    • isWritableStackTraceEnabled

      public boolean isWritableStackTraceEnabled()
      Returns:
      if any thrown MaxRetriesExceededException should contain a stacktrace
    • getIntervalFunction

      @Nullable @Deprecated public Function<Integer,Long> getIntervalFunction()
      Deprecated.
      Use intervalBiFunction instead, this method is kept for backwards compatibility
    • getIntervalBiFunction

      public <T> io.github.resilience4j.core.IntervalBiFunction<T> getIntervalBiFunction()
      Return the IntervalBiFunction which calculates wait interval based on result or exception
      Type Parameters:
      T - The type of result.
      Returns:
      the interval bi function
    • getExceptionPredicate

      public Predicate<Throwable> getExceptionPredicate()
    • getResultPredicate

      @Nullable public <T> Predicate<T> getResultPredicate()
      Return the Predicate which evaluates if an result should be retried. The Predicate must return true if the result should be retried, otherwise it must return false.
      Type Parameters:
      T - The type of result.
      Returns:
      the result predicate
    • getConsumeResultBeforeRetryAttempt

      public <T> BiConsumer<Integer,T> getConsumeResultBeforeRetryAttempt()
      Return the BiConsumer which performs post actions if the result should be retried.
      Type Parameters:
      T - The type of result.
      Returns:
      the onFailureBiConsumer