reactor-kotlin-extensions / reactor.kotlin.extra.retry / reactor.core.publisher.Flux / repeatExponentialBackoff

repeatExponentialBackoff

fun <T> Flux<T>.repeatExponentialBackoff(times: Long, first: Duration, max: Duration? = null, jitter: Boolean = false, doOnRepeat: ((RepeatContext<T>) -> Unit)? = null): Flux<T>

Extension to add a Flux.repeat variant to Flux that uses an exponential backoff, as enabled by reactor-extra's Repeat 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

jitter - optional flag to activate random jitter in the backoffs

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

Author
Simon Baslé

Since
3.1.1