0

我已经编写了自定义事件通知器并在 HystrixPlugins 中注册了它。我有需要在打开和关闭电路时发送通知的要求。要跟踪电路开路,我可以使用以下事件类型

 HystrixEventType.SHORT_CIRCUITED

但是从打开到关闭的过渡呢?hystrix 中是否有任何方法可以跟踪以前打开的电路现在已关闭?

下面是我的事件通知器。

public class CircuitBreakerHystrixEventNotifier extends HystrixEventNotifier{

    @Resource
    private List<HystrixNotification> notificationHandlers;

    public CircuitBreakerHystrixEventNotifier(){

    }

    public void markEvent(HystrixEventType eventType, HystrixCommandKey key) {
        super.markEvent(eventType, key);
        if(notificationHandlers != null && notificationHandlers.size() > 0){
            for (HystrixNotification notificationHandler : notificationHandlers){
                notificationHandler.notify(eventType, key);
            }
        }
    }
}
4

0 回答 0