First time I use retry pattern in reactor.
I have got totally confused with the management of retrying in reactor. The main source of confusion is the existing 2 Retry classes in the same package!
I want to retry a Mono/Flux process when specific exceptions happens, during a max number of times.
My first step is create a reactor.retry.Retry
in this way.
reactor.retry.Retry retry = reactor.retry.Retry
.anyOf(
WebClientResponseException.BadRequest.class,
WebClientResponseException.BadGateway.class)
.retryMax(nRetries);
And then, I want to parameterize my mono with
mymono.retryWhen(utilRetry);
Following the documentation in Interface Retry I have to convert the reactor.retry.Retry
object in a reactor.util.retry.Retry
using the method withThrowable
, but there is no sample (and the sample in the doc doesn't work because the objects are not compatible).
So, I'm looking for something like
utilRetry=retry.somemethod()
Any comment for newbie will be welcome!
UPDATE:
I have found this issue reactor.retry.Retry does not provide methods for Mono.retryWhen(Retry retrySpec) #231 where it seems there is some migration conflics, but does not provide a canonical solution