当前位置:网站首页>[microservices openfeign] timeout of openfeign
[microservices openfeign] timeout of openfeign
2022-06-29 08:33:00 【Bulst】
List of articles
What I am currently using spring cloud Version is Hoxton.SR9, from spring-cloud-2020.0.0 Started removing a lot of Netflix Components , This is just for better application ribbon.
Because this version openfeign Internally integrated ribbon, Therefore, the ribbon Configuration to achieve changes openfeign And so on .
spring-cloud-2020.0.0 Version start , This configuration is invalidated , Available by change Request.Options, In order to achieve ribbon This effect .
Global configuration
ribbon Method to modify the timeout
# Set up feign Client timeout (OpenFeign The default support ribbon)
ribbon:
# The time taken to establish a connection , It is suitable for normal network conditions , The time taken to connect the two ends
ReadTimeout: 5000
# It refers to the time taken to read the available resources from the server after the connection is established
ConnectTimeout: 5000
Request.Options Method to modify the timeout
problem :if the request should follow 3xx redirections.
Configuration class mode
import feign.Request;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.TimeUnit;
/** * @author issavior */
@Configuration
public class FeignOptionsConfig {
/** * Timeout configuration */
@Bean
public Request.Options options() {
return new Request.Options(5, TimeUnit.SECONDS,
5, TimeUnit.SECONDS, true);
}
Configuration file mode
feign:
client:
config:
# Provider's service name
default:
# Request log level
loggerLevel: FULL
# Set as default contract ( Revert to native annotations )
# contract: feign.Contract.Default
# Connection timeout , Default 2s, The setting unit is milliseconds
connectTimeout: 5000
# Request processing timeout , Default 5s, The setting unit is milliseconds .
readTimeout: 5000
Local configuration
feign:
client:
config:
# Provider's service name
ossa-service-producer:
# Request log level
loggerLevel: FULL
# Set as default contract ( Revert to native annotations )
# contract: feign.Contract.Default
# Connection timeout , Default 2s, The setting unit is milliseconds
connectTimeout: 5000
# Request processing timeout , Default 5s, The setting unit is milliseconds .
readTimeout: 5000
The source code parsing
Relevant source code sorting 【 I only cut a few source images , I'm sure you old fans can understand // The dog's head lives 】
Here, first initialize , The default connection and read times are 1000 millisecond , Load into memory .



If in the configuration file , Yes ribbon Related configuration , Then refresh / Overwrite the corresponding value in memory .



边栏推荐
- [redis] redis6 learning framework ideas and details
- [domain penetration authorization] cve-2020-1472 Netlogon privilege escalation vulnerability
- Voice processing tool: Sox
- 对话| 数字时代,隐私计算的发展前景与挑战
- 苹果开发者容易招致调查的若干行为
- 《乔布斯传》英文原著重点词汇笔记(七)【 chapter five】
- [eye of depth wuenda machine learning homework class phase IV] summary of logistic regression
- Segment tree and use
- 语音信号处理-基础(一):声学基础知识
- Flutter 文件读写-path_provider
猜你喜欢

802.11--802.11n协议 PHY

What are the organizational structure and job responsibilities of product managers in Internet companies?
![[eye of depth wuenda machine learning homework class phase IV] regularization regularization summary](/img/24/3d0b892c0eaa330f0c69764de5da13.png)
[eye of depth wuenda machine learning homework class phase IV] regularization regularization summary

Should product managers learn from ink knife or Axure?

分布式数字身份的几个“非技术”思考
![Target tracking [single target tracking (vot/sot), target detection, pedestrian re identification (re ID)]](/img/f2/d42032f05214a4ad9339ea18966cc2.jpg)
Target tracking [single target tracking (vot/sot), target detection, pedestrian re identification (re ID)]

Swift中@dynamicMemberLookup和callAsFunction特性实现对象透明代理功能

Message Oriented Middleware: pulsar

一个高频问题,三种模型思维来破解此风控难题

华为设备配置中型网络WLAN基本业务
随机推荐
Notes on key words in the original English work biography of jobs (VII) [chapter five]
常见的七大排序
Soliciting articles and contributions - building a blog environment with a lightweight application server
开户买基金,通过网上基金开户安全吗?-
关于SQL语句的大小写
Np5 formatted output (III)
Simple use of AWS elastic Beanstalk
A review of visual SLAM methods for autonomous driving vehicles
Target tracking [single target tracking (vot/sot), target detection, pedestrian re identification (re ID)]
重磅发布 | 《FISCO BCOS应用落地指南》
Hook introduction
[quantitative investment system]django realizes screening and paging from the database
Flutter shared_preferences使用
【LoRaWAN节点应用】安信可Ra-08/Ra-08H模组入网LoRaWAN网络的应用及功耗情况
Taro 介绍
MySQL按天/周/月/季度/半年/年统计数据
Voice processing tool: Sox
aws elastic beanstalk入门之简单使用
互斥量互斥锁
[quantitative investment system] factor processing and installation Talib