我正在将Hystrix集成到应用程序中。该应用程序已经投入生产,在将其推向生产之前,我们将在沙箱中测试hystrix集成工作。我的问题是,有没有办法使用一些配置设置来打开/关闭hystrix功能?
发布于 2016-03-22 07:49:51
对于这一点没有单一的设置。您需要设置多个参数来禁用Hystrix。
有关配置选项,请参阅https://github.com/Netflix/Hystrix/wiki/Configuration:
hystrix.command.default.execution.isolation.strategy=SEMAPHORE
hystrix.command.default.execution.isolation.semaphore.maxConcurrentRequests=100000 # basically 'unlimited'
hystrix.command.default.execution.timeout.enabled=false
hystrix.command.default.circuitBreaker.enabled=false
hystrix.command.default.fallback.enabled=false请仔细检查您的Hystrix版本以获取可用的参数。
发布于 2018-09-27 14:45:22
这就是你所需要的:
# Disable Circuit Breaker (Hystrix)
spring:
cloud:
circuit:
breaker:
enabled: false
hystrix:
command:
default:
circuitBreaker:
enabled: false发布于 2016-05-18 10:19:56
正如ahus1所说,没有单一的方法可以完全禁用Hystrix。为了在我们的应用程序中禁用它,我们认为将HystrixCommand放在包装类中是最干净、最安全的,而且包装类只公开了我们使用的HystrixCommand的一部分(在本例中是execute()方法)。在构造包装器类时,我们向它传递一个Callable,其中包含我们想要执行的代码,如果Hystrix被禁用(根据我们自己的配置值),我们只需调用该Callable,而无需创建HystrixCommand。这避免了执行任何Hystrix代码,并且更容易说Hystrix在被禁用时根本不会影响我们的应用程序。
https://stackoverflow.com/questions/36090935
复制相似问题