Interface ICircuitBreakerPolicy
- Namespace
- WorkflowForge.Extensions.Resilience.Abstractions
- Assembly
- WorkflowForge.Extensions.Resilience.dll
Interface for circuit breaker policies.
public interface ICircuitBreakerPolicy : IDisposable
- Inherited Members
Properties
State
Gets the current state of the circuit breaker.
CircuitBreakerState State { get; }
Property Value
Methods
ExecuteAsync(Func<Task>, CancellationToken)
Executes the specified operation through the circuit breaker.
Task ExecuteAsync(Func<Task> operation, CancellationToken cancellationToken = default)
Parameters
operationFunc<Task>The operation to execute.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task representing the asynchronous operation.
Exceptions
- CircuitBreakerOpenException
Thrown when the circuit breaker is open.
Events
StateChanged
Occurs when the circuit breaker state changes.
event EventHandler<CircuitBreakerStateChangedEventArgs>? StateChanged