Class CircuitBreakerMonitor
- Namespace
- Kevlar
- Assembly
- Kevlar.dll
Observes and manually controls one or more circuit breakers. Create one, assign it to each Monitor to control, and keep a reference to it.
public sealed class CircuitBreakerMonitor
- Inheritance
-
CircuitBreakerMonitor
- Inherited Members
Constructors
CircuitBreakerMonitor()
public CircuitBreakerMonitor()
Properties
State
The worst state among the bound circuits, ordered isolated, open, half-open, then closed.
public CircuitState State { get; }
Property Value
Methods
Isolate()
Forces every bound circuit open. Executions are rejected until Reset() is called. A non-reentrant caller blocks until transition observers complete; use IsolateAsync() when an OnStateChanged callback may yield. A call made from a transition observer queues its transition and returns before that queued transition reaches observers.
public void Isolate()
IsolateAsync()
Forces every bound circuit open and asynchronously waits for configured transition observers. A reentrant call from a transition callback queues its transition behind the active publication and returns before that queued transition reaches observers; do not use the returned task to order reentrant transition work. Executions are rejected until ResetAsync() is called.
public ValueTask IsolateAsync()
Returns
Reset()
Closes every bound circuit and clears all failure metrics. A non-reentrant caller blocks until transition observers complete; use ResetAsync() when an OnStateChanged callback may yield. A call made from a transition observer queues its transition and returns before that queued transition reaches observers.
public void Reset()
ResetAsync()
Closes every bound circuit, clears all failure metrics, and asynchronously waits for configured transition observers. A reentrant call from a transition callback queues its transition behind the active publication and returns before that queued transition reaches observers; do not use the returned task to order reentrant transition work.
public ValueTask ResetAsync()
Returns
Events
StateChanged
Raised on every state transition of each bound circuit, after OnStateChanged completes. Transitions are delivered serially per circuit outside its lock; different circuits may publish concurrently. Handlers may read state or call Reset() or Isolate() without deadlocking. Handlers run synchronously and block later transitions from the same circuit, so they should not perform I/O, wait on external work, or otherwise run for a long time.
public event Action<CircuitBreakerStateChangedEvent>? StateChanged