I am switching from feign client to reactive feign client, I have defined global retryer for feign:
@Bean
Retryer retryer() {
return new Retryer.Default(100, 1, 5);
}
@Bean
ErrorDecoder errorDecoder() {
return new HttpErrorDecoder();
}
static class HttpErrorDecoder implements ErrorDecoder {
private final ErrorDecoder defaultErrorDecoder = new Default();
@Override
public Exception decode(String methodKey, Response response) {
Exception exception = defaultErrorDecoder.decode(methodKey, response);
if (response.status() != HttpStatus.SC_OK) {
return new RetryableException(response.status(),
"api call for url: " + response.request().url() + " failed",
response.request().httpMethod(), exception.getCause(), null,
response.request());
}
return exception;
}
}
With non-reactive client retries works fine, with reactive client error decoder raises RetryableException as it should, but Retryer doesn't react - no retry is executed. I am using mostly webflux Mono<T>
, is there a way how to make it work or Retryer won't work for reactive feign? If so, is it possible to define "global retries" or do I need to define retry for every call/mono ?
Retryer was removed from Reactive client. You should use ReactiveRetryPolicy