feign.RetryableException:读取超时执行 GET [英] feign.RetryableException: Read timed out executing GET
问题描述
我的项目中有以下架构
我的 UI 服务(端口 8080)对网关服务(端口 8085)进行 Feign 调用.
我从 UI 服务的 Get 调用是"http:///localhost:8080/invoice-list?startDate=2018-08-05&endDate=2018-10-05 "
来自网关服务的类似调用 "http://localhost:8085/invoice-download-service/invoice-list?startDate=2018-08-05&endDate=2018-10-05"
My UI Service(Port 8080) making Feign call to Gateway Service(Port 8085).
My Get call from UI service is " http://localhost:8080/invoice-list?startDate=2018-08-05&endDate=2018-10-05 "
Similar call from Gateway Service "http://localhost:8085/invoice-download-service/invoice-list?startDate=2018-08-05&endDate=2018-10-05"
当我从 UI 服务进行此 GET 调用时,我会在几分钟内收到以下错误
When i make this GET call from UI service i get below error within minute
is feign.RetryableException: Read timed out executing GET http://localhost:8085/invoice-download-service/invoice-list?startDate=2018-08-05&endDate=2018-10-05] with root cause
java.net.SocketTimeoutException: Read timed out
但是当我从网关服务器直接调用微服务时,我没有出错.
But when i make direct call from Gateway Server to microservice, i dont get error.
网关服务的Application.properties文件
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=160000000
ribbon.OkToRetryOnAllOperations=true
ribbon.ReadTimeout=5000000
ribbon.ConnectTimeout=5000000
ribbon.MaxAutoRetries=3
ribbon.MaxAutoRetriesNextServer=3
zuul.host.socket-timeout-millis= 5000000
zuul.host.connect-timeout-millis= 5000000
在这里,我将 readtimeout 和 connecttimeout 属性设置为大约 8 到 10 分钟,因此我没有收到错误.
Here i have set readtimeout and connecttimeout property around 8 to 10 min, hence i am not getting error.
UI 服务的Application.properties 文件
spring.application.name=external-ui-service
server.port=8080
在 UI 服务中,我没有超时属性.我在这里尝试了上述属性但没有工作.显然这个 UI 服务没有使用ribbon、zuul 等.这只是对网关的 Feign 调用.
Here in UI service i dont have timeout property. I tried above properties here but not working. Obviously this UI service is not using ribbon,zuul etc. This is just an making Feign call to gateway.
那么我应该怎么做才能增加 UI 服务的超时时间?
So what should i do to increase timeout in UI service?
推荐答案
在 UI Service 的 application.propeties 文件中添加以下属性.
Added below properties in UI Service's application.propeties file.
feign.client.config.default.connectTimeout: 160000000
feign.client.config.default.readTimeout: 160000000
这篇关于feign.RetryableException:读取超时执行 GET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!