spring cloud 2.1.3 zuul 重試配置生效

 

  # hystrix 超時時間最好大於Ribbon ReadTimeout+ConnectTimeout的超時時間
hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 30000
  #對當前實例的重試次數
  #切換實例的重試次數
  #請求處理的超時時間
  #請求連接的超時時間
  #對所有操作請求都進行重試
ribbon:
   MaxAutoRetries: 1
   MaxAutoRetriesNextServer: 1
   ReadTimeout: 5000
   ConnectTimeout: 2000
   OkToRetryOnAllOperations: true

我在配置了   Zuul的 熔斷和重試以後 ,一直到ribbo超時後就直接返回錯誤編碼  hystrix不生效,經過板磚發現 需要在zuul中加入

<dependency>
    <groupId>org.springframework.retry</groupId>
    <artifactId>spring-retry</artifactId>
    <version>1.2.1.RELEASE</version>
</dependency>

加入就生效了 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章