Spring Boot应用程序,其中hystrix timeoutInMilliseconds卡住了/没有响应

时间:2019-01-22 05:40:25

标签: java spring-boot hystrix

具有hystrixapplication.yml配置的Spring Boot应用程序:

hystrix:
  command:
    myCommand:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 2000

足够有趣的是,  当我为timeoutInMilliseconds设置值 1 时 我的服务,带有以下注释:

@HystrixCommand(
        raiseHystrixExceptions = {HystrixException.RUNTIME_EXCEPTION},
        groupKey = "myGroup", commandKey = "myCommand", threadPoolKey = "myGroup")
@Override .... myMethod() { ...

是否应该具有超时异常(应该如此)

但是,当我将值设置为10,200,2000时,我的服务永不响应,它永远卡住了。

我已经检查过此reply

我是expecting to findconnection.timeout的配置。 就我而言,我的服务尝试连接到在VPN上运行的服务。所以..它正在尝试连接到该服务..并且它从未获得此连接。我希望它因超时而失败。但事实并非如此。

最后,我只打电话给

Mono.fromCallable( () -> {
        RestTemplate rest ...
    responseEntity = rest.exchange(baseUrl + uri, HttpMethod.POST, 
 requestEntity, String.class); }

永久挂起的

Q:H ow,以防止分发服务。我的配置出了什么问题?如何解决?

0 个答案:

没有答案