HttpRequestRetry
class HttpRequestRetry
A plugin that enables the client to retry failed requests. The default retry policy is 3 retries with exponential delay. Typical usages:
// use predefined retry policies
install(HttpRequestRetry) {
retryOnServerErrors(maxRetries = 3)
exponentialDelay()
}
// use custom policies
install(HttpRequestRetry) {
maxRetries = 5
retryIf { request, response -> !response.status.isSuccess() }
retryOnExceptionIf { request, cause -> cause is NetworkError }
delayMillis { retry -> retry * 3000 } // will retry in 3, 6, 9, etc. seconds
modifyRequest { it.headers.append("X_RETRY_COUNT", retryCount.toString()) }
}
Content copied to clipboard
Types
Link copied to clipboard
class Configuration
Contains HttpRequestRetry configurations settings.
Link copied to clipboard
class DelayContext
A context for HttpRequestRetry.Configuration.delayMillis. Contains a non-null response or cause but not both.
Link copied to clipboard
class ModifyRequestContext
A context for HttpRequestRetry.Configuration.modifyRequest. Contains a non-null response or cause but not both.
Link copied to clipboard
Link copied to clipboard
class RetryEventData
Data for the HttpRequestRetryEvent event. Contains a non-null response or cause but not both.
Link copied to clipboard