Hystrix命令注释在应用中如何工作?

问题描述 投票:0回答:1

当我用@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个回答
0
投票

enter image description here

  1. 你有你的API类和API类中的方法,它被注解为@HystrixCommand。

  2. Hystrix将你的API类包装在一个代理类中。

  3. 当你请求一个API类的实例时,那么代理类的实例将被得到。

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

  5. 当有人进行调用时,Hystrix不断地监控,什么是返回。

  6. 代理类-->得到一个调用,并传递给API类中的实际方法,并得到响应返回和检查确保并返回。

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

© www.soinside.com 2019 - 2024. All rights reserved.