栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Spring Cloud Feign Client 各种超时配置

Spring Cloud Feign Client 各种超时配置

最近使用feign接口调用需要修改访问超时时间,但是配置入口众多,无从下手。特此记录一下

首先看一下配置

#hystrix的超时时间
hystrix:
  command:
    default:
      execution:
        timeout:
          enabled: true
        isolation:
          strategy: SEMAPHORE
          semaphore:
            maxConcurrentRequests: 100
          thread:
            timeoutInMilliseconds: 6000
#ribbon的超时时间
ribbon:
  ReadTimeout: 6000
  ConnectTimeout: 6000
feign:
  okhttp:
    enabled: true
    readTimeout: 60
    connectTimeout: 60
  hystrix:
    enabled: true

经过测试feign.okhttp.readTimeout和feign.okhttp.connectTimeout配置不生效,后来查阅资料发现

关于超时时间的优先级 hystrix > ribbon >feign

feign的超时时间需要一下配置才可以

# default context 连接超时时间
feign.client.config.default.connectTimeout = 5000
# default context 读超时时间
feign.client.config.default.readTimeout = 10000
参考链接:https://blog.csdn.net/agonie201218/article/details/118802928?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~aggregatepage~first_rank_ecpm_v1~rank_v31_ecpm-1-118802928.pc_agg_new_rank&utm_term=feign%E4%BD%BF%E7%94%A8okhttp%E8%AE%BE%E7%BD%AE%E8%B6%85%E6%97%B6%E6%97%B6%E9%97%B4&spm=1000.2123.3001.4430

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/745350.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号