gpt4 book ai didi

spring-boot - Hystrix Command注解在应用中是如何工作的

转载 作者:行者123 更新时间:2023-12-02 19:30:19 24 4
gpt4 key购买 nike

当我用@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)
{

}

最佳答案

enter image description here

  1. 您有自己的 API 类和 API 类中的方法,这些方法用 @HystrixCommand 注释。

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

  3. 当您询问 API 类的实例时,将获取代理类的实例

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

  5. 当有人调用电话时,Hystrix 会持续监控返回的内容。

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

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

关于spring-boot - Hystrix Command注解在应用中是如何工作的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61932447/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com