reactor-kotlin-extensions / reactor.kotlin.extra.retry / reactor.core.publisher.Mono / retryRandomBackoff

retryRandomBackoff

fun <T> Mono<T>.retryRandomBackoff(times: Long, first: Duration, max: Duration? = null, doOnRetry: ((RetryContext<T>) -> Unit)? = null): Mono<T>

Extension to add a Mono.retry variant to Mono that uses a random backoff, as enabled by reactor-extra's Retry builder.

Parameters

times - the maximum number of retry attempts

first - the initial delay in retrying

max - the optional upper limit the delay can reach after subsequent backoffs

doOnRetry - optional Consumer-like lambda that will receive a RetryContext each time an attempt is made.

Author
Simon Baslé

Since
3.1.1