I want to manage retries. I have openfeign client, two micro-services. How to do it? When i set in my yaml configuration:
foo:
ribbon:
MaxAutoRetries:5
It doesn't work. In my pom.xml is Spring Cloud Greenwich RELEASE, spring-retry and open-feign dependencies. I don't use any service discovery.
I added to my feign method annotations: @FeignClient(name="foo", url="...") and @RibbonClient(name="foo").
I don't see any ribbon logs after start application and when i do http feign request. Should ribbon be configured on both microservices?
You can create a Configuration
for Retryer
's feign and set the values you want:
import feign.Retryer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FeignClientConfig {
@Bean
public Retryer retryer() {
// Default(long period, long maxPeriod, int maxAttempts)
return new Retryer.Default(1, 100, 3);
}
}