Does Feign retry require some sort of configuration?

Kristoffer picture Kristoffer · Mar 20, 2015 · Viewed 10.7k times · Source

I just tried to do a attempted a seamless upgrade of a service in a test setup. The service is being accessed by a Feign client. And naively I was under the impression that with multiple instances available of the service, the client would retry another instance if it failed to connect to one.

That, however, did not happen. But I cannot find any mention of how Feign in Spring Cloud is supposed to be configured to do this? Although I have seen mentions of it supporting it (as opposed to using RestTemplate where you would use something like Spring Retry?)

Answer

spencergibb picture spencergibb · Mar 20, 2015

If you are using ribbon you can set properties similar to the following (substituting "localapp" for your serviceid):

localapp.ribbon.MaxAutoRetries=5
localapp.ribbon.MaxAutoRetriesNextServer=5
localapp.ribbon.OkToRetryOnAllOperations=true