RetryPluginConfigBuilder
Builder for configuring the KresilRetryPlugin.
Properties
Functions
Aggregates all configured retry predicates to determine if the HTTP call should be retried based on the caught throwable.
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 retry plugin.
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:
Modifies the request between retries, before it is sent. The block receives the HttpRequestBuilder and the current retry attempt as arguments.
Configures a predicate to determine if an HTTP call should be retried based on the respective request and response.
Configures the retry predicate, used to determine if, based on the caught throwable, the underlying request should be retried.
Retries the HTTP call if the response status code is in the range: 500-599.
Retries the HTTP call if the request method is idempotent (i.e., the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request) and the response status code is in the specified range. Idempotent methods supported by Ktor are: GET
, HEAD
, OPTIONS
, PUT
, DELETE
.
Retries the HTTP call if the exception thrown is a timeout exception. See HttpTimeout plugin for more information on possible timeout exceptions. If this method is used, HttpTimeout plugin should be installed after this plugin.