Interface IDistributedCircuitBreaker
- Namespace
- Excalibur.Dispatch.Resilience.Polly
- Assembly
- Excalibur.Dispatch.Resilience.Polly.dll
Distributed circuit breaker for coordinating state across multiple instances.
public interface IDistributedCircuitBreaker
- Extension Methods
Methods
ExecuteAsync<T>(Func<Task<T>>, CancellationToken)
Executes an operation with distributed circuit breaker protection.
Task<T> ExecuteAsync<T>(Func<Task<T>> operation, CancellationToken cancellationToken)
Parameters
operationFunc<Task<T>>The operation to execute within the circuit breaker.
cancellationTokenCancellationTokenA token that is observed for cancellation.
Returns
- Task<T>
A task that completes with the asynchronous result.
Type Parameters
TThe type returned by the asynchronous
operation.
GetStateAsync(CancellationToken)
Gets the current state of the circuit breaker.
Task<CircuitState> GetStateAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA token that is observed for cancellation.
Returns
- Task<CircuitState>
A task that completes with the distributed circuit state.
RecordFailureAsync(CancellationToken, Exception?)
Records a failure in the distributed state.
Task RecordFailureAsync(CancellationToken cancellationToken, Exception? exception = null)
Parameters
cancellationTokenCancellationTokenA token that is observed for cancellation.
exceptionExceptionThe exception being evaluated.
Returns
- Task
A task that completes when the update is persisted.
RecordSuccessAsync(CancellationToken)
Records a success in the distributed state.
Task RecordSuccessAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA token that is observed for cancellation.
Returns
- Task
A task that completes when the update is persisted.
ResetAsync(CancellationToken)
Resets the circuit breaker across all instances.
Task ResetAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task representing the reset operation.