4

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?)

Kristoffer
  • 410
  • 2
  • 6
  • 16

3 Answers3

4

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
spencergibb
  • 24,471
  • 6
  • 69
  • 75
2

ps underneath Feign has a Retryer interface, which was made to support things like Ribbon.

https://github.com/Netflix/feign/blob/master/core/src/main/java/feign/Retryer.java

Adrian Cole
  • 792
  • 4
  • 10
  • 2
    Adrian, how the feign retyer and the ribbon retry mechnism work together? is there any example or docs about it – Roi Ezra Mar 30 '17 at 06:30
1

see if property works - OkToRetryOnAllOperations: true

You can refer application -> https://github.com/spencergibb/spring-cloud-sandbox/blob/master/spring-cloud-sandbox-sample-frontend/src/main/resources/application.yml

Spencer was quick...was late by few minutes :-)

Vibhaanshu
  • 169
  • 2
  • 10