当前位置:网站首页>[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 .



边栏推荐
- [domain penetration authorization] cve-2020-1472 Netlogon privilege escalation vulnerability
- Summary of various series (harmonic, geometric)
- 马赛克笔记
- 对话| 数字时代,隐私计算的发展前景与挑战
- php 清除多维数组里面的空值
- Development trend of garment industry | supply chain | intelligent manufacturing
- 各种级数(调和、几何)总结
- Notes on key words in the original English work biography of jobs (VIII) [chapter six]
- [quantitative investment system]django realizes screening and paging from the database
- Simple use of AWS elastic Beanstalk
猜你喜欢

1284_FreeRTOS任务优先级获取实现分析

STM32基于HAL库的USART+DMA使用

重磅发布 | 《FISCO BCOS应用落地指南》

aws elastic beanstalk入门之简单使用

Binary search tree
![[6G] collation of white paper on computing network technology](/img/a3/8e60eef55ebcd91fa6188722c87a70.png)
[6G] collation of white paper on computing network technology

对话| 数字时代,隐私计算的发展前景与挑战
![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)]

Blueprint basis

What are the constraints in MySQL? (instance verification)
随机推荐
324. 摆动排序 II / 剑指 Offer II 102. 加减的目标值
Using method and de duplication of distinct() in laravel
Soliciting articles and contributions - building a blog environment with a lightweight application server
关于父母离婚后子女姓名变更有关问题的批复
PostgreSQL installation: the database cluster initialization failed, stack hbuilder installation
表格背单词的方法
Indextree and Application
Flutter shared_ Preferences use
Notice on organizing the second round of the Northwest Division (Shaanxi) of the 2021-2022 National Youth electronic information intelligent innovation competition
Target tracking [single target tracking (vot/sot), target detection, pedestrian re identification (re ID)]
aws iam内联策略示例
Voice processing tool: Sox
Speech signal processing - Fundamentals (I): basic acoustic knowledge
馬賽克筆記
[6G] collation of white paper on computing network technology
Voice annotation tool: Praat
语音处理工具:sox
Linear regression with one variable
Verilog初体验
php 清除多维数组里面的空值