1.简述
Hystrix在donet中的应用案例说明极少且不完整,此案例可以直接使用,基于donet4
适用点:隔离,熔断,降级,来解决web在高并发下,对远程服务的高依赖可能引起的雪崩问题
可以自己到github下载源码使用, 注意:直接下载的部分源码有问题,本案例已经修复这些bug
2.下载组件
链接: https://pan.baidu.com/s/1BM9VX4Z5Htc1Zxxvf9-u1A
3.组件结构
WEB URL:http://localhost:9000/dashboard/
STREAM URL: http://127.0.0.1:38080/Hystrix/
4.业务web中引入全部核心组件和独立组件,新建
-------AtlasPublisher.cs--------
public class AtlasPublisher : IHystrixMetricsPublisher
{
CommandMetricObserver observer;
public AtlasPublisher()
{
var atlasCfg = new AtlasConfig("http://10.0.75.2", 7101);
observer = new CommandMetricObserver(atlasCfg);
observer.Run();
}
public IHystrixMetricsPublisherCommand GetMetricsPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties)
{
return new HystrixServoMetricsPublisherCommand(commandKey, commandGroupKey, metrics, circuitBreaker, properties);
}
public IHystrixMetricsPublisherThreadPool GetMetricsPublisherForThreadPool(Hystrix
Hystrix在donet中的应用案例说明极少且不完整,此案例可以直接使用,基于donet4
适用点:隔离,熔断,降级,来解决web在高并发下,对远程服务的高依赖可能引起的雪崩问题
可以自己到github下载源码使用, 注意:直接下载的部分源码有问题,本案例已经修复这些bug
2.下载组件
链接: https://pan.baidu.com/s/1BM9VX4Z5Htc1Zxxvf9-u1A
3.组件结构
WEB URL:http://localhost:9000/dashboard/
STREAM URL: http://127.0.0.1:38080/Hystrix/
4.业务web中引入全部核心组件和独立组件,新建
-------AtlasPublisher.cs--------
public class AtlasPublisher : IHystrixMetricsPublisher
{
CommandMetricObserver observer;
public AtlasPublisher()
{
var atlasCfg = new AtlasConfig("http://10.0.75.2", 7101);
observer = new CommandMetricObserver(atlasCfg);
observer.Run();
}
public IHystrixMetricsPublisherCommand GetMetricsPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties)
{
return new HystrixServoMetricsPublisherCommand(commandKey, commandGroupKey, metrics, circuitBreaker, properties);
}
public IHystrixMetricsPublisherThreadPool GetMetricsPublisherForThreadPool(Hystrix