FeignClient超时如何解决

新手上路,请多包涵

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

错误:

线程“pool-10-thread-14”中的异常 feign.RetryableException:读取超时执行 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

任何人都知道如何解决这个问题?

谢谢。

原文由 Renan Lalier 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 707
1 个回答

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

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

原文由 chaitanya dalvi 发布,翻译遵循 CC BY-SA 4.0 许可协议

推荐问题