请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

feign-hystrix 的服务熔断怎么实现了?

老师,在这一个章节中讲了服务的降级,那如何在接口中加入服务的熔断了?

正在回答 回答被采纳积分+3

3回答

qq_Mel_0 2018-06-02 01:28:50

这个问题已经解决了,将熔断的配置到 yml 文件中就行了

0 回复 有任何疑惑可以回复我~
  • 求怎么配置?我这样配置无效:
    
    ```yml
    hystrix:
      command:
        default:
          execution:
            isolation:
              thread:
                timeoutInMilliseconds: 3000
                requestVolumeThreshold: 10
                sleepWindowInMilliseconds: 10000
                errorThresholdPercentage: 60
    ```
    回复 有任何疑惑可以回复我~ 2019-02-27 11:53:50
qq_Mel_0 2018-06-01 23:51:04

这个不是服务降级的配置嘛?

设置了  feign.hystrix.enabled: true 之后 熔断也起效了吗

0 回复 有任何疑惑可以回复我~
w84422 2018-04-29 22:51:05

应该是只能在配置文件中配置circuitBreaker的4个属性,默认key的规则是 ${FeignClient的接口名}#${Mapping方法名}(${参数类型}), 例如:"ProductClient#list(List)"

hystrix:
 command:

     "ProductClient#list(List)":
         execution:
            isolation:
                  thread:
                         timeoutInMilliseconds: 1000

——————————


@FeignClient(name="product", fallback = ProductClient.ProductClientFallBack.class)  // 表示访问哪个应用的接口
public interface ProductClient {

   @GetMapping("/product/listByIds")
   String list(@RequestBody List<String> ids);


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信