Package io.github.resilience4j.retry
Class RetryConfig
java.lang.Object
io.github.resilience4j.retry.RetryConfig
- All Implemented Interfaces:
Serializable
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final long -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> RetryConfig.Builder<T>custom()Returns a builder to create a custom RetryConfig.static <T> RetryConfig.Builder<T>from(RetryConfig baseConfig) <T> BiConsumer<Integer,T> Return the BiConsumer which performs post actions if the result should be retried.<T> io.github.resilience4j.core.IntervalBiFunction<T>Return the IntervalBiFunction which calculates wait interval based on result or exceptionDeprecated.int<T> Predicate<T>Return the Predicate which evaluates if an result should be retried.booleanbooleanstatic RetryConfigCreates a default Retry configuration.
-
Field Details
-
DEFAULT_WAIT_DURATION
public static final long DEFAULT_WAIT_DURATION- See Also:
-
DEFAULT_MAX_ATTEMPTS
public static final int DEFAULT_MAX_ATTEMPTS- See Also:
-
-
Method Details
-
custom
Returns a builder to create a custom RetryConfig.- Type Parameters:
T- The type being built.- Returns:
- a
RetryConfig.Builder
-
from
-
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
MaxRetriesExceededExceptionshould contain a stacktrace
-
getIntervalFunction
Deprecated.UseintervalBiFunctioninstead, 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
-
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
Return the BiConsumer which performs post actions if the result should be retried.- Type Parameters:
T- The type of result.- Returns:
- the onFailureBiConsumer
-