Does Feign retry require some sort of configuration?

心不动则不痛 提交于 2019-11-30 17:55:07

问题


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


回答1:


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



回答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




回答3:


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



来源:https://stackoverflow.com/questions/29168157/does-feign-retry-require-some-sort-of-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!