FeignClient超时如何解决 [英] How to solve Timeout FeignClient

查看:33
本文介绍了FeignClient超时如何解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用使用 FeignClient 在 SQL Server 中执行查询的服务时,我的应用程序出现以下错误.

My application is getting below error when consuming a service that performs queries in SQL Server using FeignClient.

错误:

线程pool-10-thread-14"中的异常 feign.RetryableException:读取执行 GET 超时http://127.0.0.1:8876/processoData/搜索/buscaProcessoPorCliente?cliente=ELEKTRO++-+TRABALHISTA&estado=SP

Exception in thread "pool-10-thread-14" feign.RetryableException: Read timed out executing GET http://127.0.0.1:8876/processoData/search/buscaProcessoPorCliente?cliente=ELEKTRO+-+TRABALHISTA&estado=SP

我的消费者服务:

@FeignClient(url="http://127.0.0.1:8876")
public interface ProcessoConsumer {

@RequestMapping(method = RequestMethod.GET, value = "/processoData/search/buscaProcessoPorCliente?cliente={cliente}&estado={estado}")
public PagedResources<ProcessoDTO> buscaProcessoClienteEstado(@PathVariable("cliente") String cliente, @PathVariable("estado") String estado);

}

我的 YML:

server:
  port: 8874

endpoints:
  restart:
    enabled: true
  shutdown:
    enabled: true
  health:
    sensitive: false

eureka:
  client:
  serviceUrl:
    defaultZone: ${vcap.services.eureka-service.credentials.uri:http://xxx.xx.xxx.xx:8764}/eureka/
  instance: 
    preferIpAddress: true

ribbon:
  eureka:
    enabled: true

spring:
  application:
    name: MyApplication
  data:
    mongodb:
      host: xxx.xx.xxx.xx
      port: 27017
      uri: mongodb://xxx.xx.xxx.xx/recortesExtrator
      repositories.enabled: true
    solr:
      host: http://xxx.xx.xxx.xx:8983/solr
      repositories.enabled: true

有人知道怎么解决吗?

谢谢.

推荐答案

将以下属性添加到 application.properties 文件中,以毫秒为单位.

Add the following properties into application.properties file, in milliseconds.

feign.client.config.default.connectTimeout=160000000
feign.client.config.default.readTimeout=160000000

这篇关于FeignClient超时如何解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆