|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.hystrix.strategy.eventnotifier.HystrixEventNotifier
public abstract class HystrixEventNotifier
Abstract EventNotifier that allows receiving notifications for different events with default implementations.
Custom implementations of this interface can be used to override default behavior via 2 mechanisms:
1) Injection
Implementations can be injected into HystrixCommand and HystrixCollapser implementation constructors.
2) Plugin
Using HystrixPlugins.registerEventNotifier(com.netflix.hystrix.strategy.eventnotifier.HystrixEventNotifier) an implementation can be registered globally to take precedence and override all other implementations.
The order of precedence is:
HystrixPlugins.registerEventNotifier(com.netflix.hystrix.strategy.eventnotifier.HystrixEventNotifier)HystrixCommand and HystrixCollapser constructorsHystrixEventNotifierDefault
The injection approach is effective for HystrixCommand and HystrixCollapser implementations where you wish to have a different default mechanism for event notification without
overriding all implementations. It is also useful when distributing a library where static override should not be used.
The globally registered plugin is useful when using commands from 3rd party libraries and you want to override how event notifications are performed for all implementations in your entire system.
| Constructor Summary | |
|---|---|
HystrixEventNotifier()
|
|
| Method Summary | |
|---|---|
void |
markCommandExecution(HystrixCommandKey key,
HystrixCommandProperties.ExecutionIsolationStrategy isolationStrategy,
int duration,
java.util.List<HystrixEventType> eventsDuringExecution)
Called after a command is executed using thread isolation. |
void |
markEvent(HystrixEventType eventType,
HystrixCommandKey key)
Called for every event fired. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HystrixEventNotifier()
| Method Detail |
|---|
public void markEvent(HystrixEventType eventType,
HystrixCommandKey key)
Default Implementation: Does nothing
eventType - key -
public void markCommandExecution(HystrixCommandKey key,
HystrixCommandProperties.ExecutionIsolationStrategy isolationStrategy,
int duration,
java.util.List<HystrixEventType> eventsDuringExecution)
Will not get called if a command is rejected, short-circuited etc.
Default Implementation: Does nothing
key - HystrixCommandKey of command instance.isolationStrategy - HystrixCommandProperties.ExecutionIsolationStrategy the isolation strategy used by the command when executedduration - time in milliseconds of executing run() methodeventsDuringExecution - List<HystrixEventType> of events occurred during execution.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||