【问题标题】:How does Hystrix Command annotation work in the applicationHystrix Command 注解在应用程序中是如何工作的
【发布时间】:2020-09-07 23:04:48
【问题描述】:

当我使用 @HystrixCommand Annotation 注释方法时,它是如何工作的

@HystrixCommand(fallbackMethod="getfallBackdisplayDoctorsAndProducts_lipid",
            commandProperties= {
                @HystrixProperty(name="execution.isolation.thread.timeoutInMilliseconds",value="150"),
                    @HystrixProperty(name="circuitBreaker.requestVolumeThreshold",value="25"),
                    @HystrixProperty(name="circuitBreaker.errorThresholdPercentage",value="50"),
                    @HystrixProperty(name="circuitBreaker.sleepWindowInMilliseconds",value="5000")
            })
    public List<DoctorsAndProducts> displayDoctorsAndProducts(LipidProfile lipidProfile)
    {

    }

【问题讨论】:

    标签: spring-boot microservices netflix-eureka hystrix


    【解决方案1】:

    1. 你有你的 API 类和 API 类中的方法,用 @HystrixCommand 注释。

    2. Hystrix 将您的 API 类包装在代理类中。

    3. 当你请求一个 API 类的实例时,就会得到代理类的实例

    4. 代理类包含断路器逻辑。

    5. 当有人拨打电话时,Hystrix 会不断监控返回的内容。

    6. 代理类->获取调用并传递给API类中的实际方法并获取响应并检查并返回。

      7.当事情失败时,代理类调用fallback方法直到恢复。

    【讨论】:

      猜你喜欢
      • 2019-06-11
      • 2020-06-14
      • 2015-10-09
      • 1970-01-01
      • 2015-04-08
      • 1970-01-01
      • 2011-04-01
      • 2015-09-29
      相关资源
      最近更新 更多