伪装重试是否需要某种配置? [英] Does Feign retry require some sort of configuration?
问题描述
我只是试图在测试设置中尝试无缝升级服务. Feign客户端正在访问该服务.天真地给人一种印象,即该服务具有多个可用实例,如果客户端无法连接到另一个实例,客户端将重试另一个实例.
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.
但是,这没有发生.但是我找不到关于如何配置Spring Cloud中的Feign来做到这一点的任何提及?尽管我曾经提到过它支持它(而不是使用RestTemplate,而您会使用像Spring Retry这样的东西?)
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?)
推荐答案
如果您使用功能区,则可以设置类似于以下内容的属性(将"localapp"替换为serviceid):
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
这篇关于伪装重试是否需要某种配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!