首页 > 其他 > 详细

hystrix熔断机制修改配置

时间:2018-02-12 19:43:20      阅读:833      评论:0      收藏:0      [点我收藏+]

一、修改参数

设置参数有3个地方:通过日志

2018-02-12 18:07:36.876 DEBUG HystrixPropertiesChainedProperty:93 - Flipping property: hystrix.command.HttpPostCommand.execution.isolation.thread.timeoutInMilliseconds to use NEXT property: hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds = 1000

2018-02-12 18:07:37.113 DEBUG HystrixPropertiesChainedProperty:236 - Property changed: ‘hystrix.command.HttpPostCommand.execution.isolation.thread.timeoutInMilliseconds = 500‘

可以看到3个参数  

hystrix.command.HttpPostCommand.execution.isolation.thread.timeoutInMilliseconds

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds

hystrix.command.HttpPostCommand.execution.isolation.thread.timeoutInMilliseconds

 

 》》其中default是在 command类之外

ConfigurationManager.getConfigInstance().setProperty("hystrix.command.default.circuitBreaker.forceOpen", true);

》》然后剩下的那个可以在command类内修改

技术分享图片

 

 

二、在 callback中打印异常信息

@Override
protected String getFallback() {
// String reason=null;
// if (isCircuitBreakerOpen()) {
// reason = "Circuit Breaker Open";
// } else if (isResponseRejected()) {
// reason = "Response rejected";
// } else if (isResponseTimedOut()) {
// reason = "Response timed-out";
// }


//System.out.println("进入回调");
log.info("发生了回调异常信息是"+ getExecutionException());

return null;
}

 

 

参考

http://www.cnblogs.com/ulysses-you/p/7281662.html

hystrix熔断机制修改配置

原文:https://www.cnblogs.com/amazement/p/8445294.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!