RetryConfigBuilder
Builder for configuring a RetryConfig instance. Use retryConfig to create one.
Properties
The base configuration object to be used as a starting point for building the final configuration object.
The maximum number of attempts (including the initial call as the first attempt).
Functions
Builds the RetryConfig instance with the configured properties.
Configures the retry delay strategy to use a constant delay. The delay between retries is calculated using the formula:
Configures the retry delay strategy to use a custom delay strategy.
Configures the retry delay strategy to use a custom delay provider. In contrast to customDelay, this method enables caller control over the delay provider (which is the kotlinx.coroutines.delay by default) and optional additional state between retries. See RetryCtxDelayProvider for more information and examples of usage.
Disables the exception handler. By default, the exception, if any, is thrown.
Configures the exception handler to use when retries are exhausted. By default, the exception, if any, is thrown. For example, if maximum attempts are reached and the exception handler is not set, the exception will be thrown. Use this method to handle exceptions that occur during the retry operation in a custom way (e.g., logging specific exceptions).
Configures the retry delay strategy to use the exponential backoff algorithm. The delay between retries is calculated using the formula: The algorithm is based on the formula:
Configures the retry delay strategy to use the linear backoff algorithm. The delay between retries is calculated using the formula:
Configures the retry predicate. The predicate is used to determine if, based on the caught throwable, the operation should be retried.
Configures the retry on result predicate. The predicate is used to determine if, based on the result of the operation, the operation should be retried.