How do I retry an Flux invoker?
Solution 1:
You can use retry
or retryWhen
along with the Retry API:
Flux.defer(() -> participationAdviceSource.getParticipationAdvicesByAMaximumLimitOf(numberOfAdvices))
.retryWhen(Retry.backoff(retryMaxAttempts, Duration.ofMillis(retryMinBackoff)).maxBackoff(Duration.ofMillis(retryMaxBackoff)))
A Flux.defer
wrapper is required because retry
and retryWhen
work by re-subscribing to the Flux
(if the Flux
throws an error and the retry conditions are fulfilled).