【发布时间】:2020-11-06 06:53:06
【问题描述】:
我的任务是使用 Spring Boot 检查多个 URL/端点,并在此端点不可用时运行回退方法。所以我使用 endpoint name 作为键来启动一个 hystrix 实例。
HystrixCommandKey commandKey = HystrixCommandKey.Factory.asKey(key);
HystrixCommandProperties commandProperties = HystrixPropertiesFactory.getCommandProperties(commandKey, null);
HystrixThreadPoolKey threadPoolKey = HystrixThreadPoolKey.Factory.asKey(key);
HystrixCommandMetrics hystrixCommandMetrics = HystrixCommandMetrics.getInstance(commandKey,
HystrixCommandGroupKey.Factory.asKey("transfer"), threadPoolKey, commandProperties);
ConfigurationManager.getConfigInstance().setProperty("hystrix.command.default.circuitBreaker.enabled", "true");
ConfigurationManager.getConfigInstance().setProperty("hystrix.command.default.execution.timeout.enabled",
"false");
ConfigurationManager.getConfigInstance()
.setProperty("hystrix.command.default.circuitBreaker.requestVolumeThreshold", "5");
ConfigurationManager.getConfigInstance()
.setProperty("hystrix.command.default.circuitBreaker.sleepWindowInMilliseconds", "500");
现在我面临着我无法向这个 hystrix 实例提交任何传入的请求或类。 也许有人知道如何解决这个问题,或者找到了一个很好的教程来做到这一点。 亲切的问候
马库斯
【问题讨论】:
标签: spring-boot hystrix netflix