微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Hystrix 忽略 application.properties 设置

如何解决Hystrix 忽略 application.properties 设置

我正在尝试覆盖特定命令线程池中的设置。我在 application.properties 中有以下文本,其他属性可以正常工作

hystrix.threadpool.getFunctionality.coreSize=10
hystrix.threadpool.getFunctionality.maximumSize=20
hystrix.threadpool.getFunctionality.maxQueueSize=100

并以编程方式创建我的命令

        HystrixCommandGroupKey commandGroupKey = HystrixCommandGroupKey.Factory.asKey("getFunctionality");
        HystrixThreadPoolKey threadPoolKey = HystrixThreadPoolKey.Factory.asKey("getFunctionality");
        HystrixCommandProperties.Setter commandProperties = HystrixCommandProperties.Setter()
            .withExecutionTimeoutInMilliseconds(timeout);
        HystrixCommand.Setter config = HystrixCommand.Setter
            .withGroupKey(commandGroupKey)
            .andThreadPoolKey(threadPoolKey)
            .andCommandPropertiesDefaults(commandProperties);

我在 HystrixPlugins 中检查 HystrixDynamicProperties 解析为 HystrixDynamicPropertiesArchaius

可以看到 Hystrix 尝试加载具有正确描述的属性

HystrixThreadPoolProperties.getProperty

以及键和属性的优先级

HystrixThreadPoolProperties.getProperty

它创建了新的 IntegerDynamicProperty(key)

它使用 com.netflix.hystrix.strategy.properties.archaius.HystrixDynamicPropertycom.netflix.hystrix.strategy.properties.archaius.HystrixDynamicProperty 最后调用 DynamicProperty.getInstance(propName ).

该类有一个静态映射属性 ALL_PROPS,它试图从中获取值。但是键没有出现在字典中(相信我,我是一名工程师)

part of the map

它创建了试图从中获取价值的新属性

ConfigurationBackedDynamicPropertySupportImpl.getString

但它包含 3 张地图。其中之一包含系统属性(catalina.home、环境变量等),其他为空

enter image description here

那么,问题是:在这种情况下,Hystrix 是否应该从文件中加载属性

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。