Interface IBulkheadPolicy
- Namespace
- Excalibur.Dispatch.Resilience.Polly
- Assembly
- Excalibur.Dispatch.Resilience.Polly.dll
Bulkhead isolation policy to prevent resource exhaustion.
public interface IBulkheadPolicy
- Extension Methods
Properties
HasCapacity
Gets a value indicating whether the bulkhead has available capacity.
bool HasCapacity { get; }
Property Value
Methods
ExecuteAsync<T>(Func<CancellationToken, Task<T>>, CancellationToken)
Executes an operation that observes both caller cancellation and its execution timeout.
Task<T> ExecuteAsync<T>(Func<CancellationToken, Task<T>> operation, CancellationToken cancellationToken)
Parameters
operationFunc<CancellationToken, Task<T>>The operation, which must observe the supplied strategy token.
cancellationTokenCancellationTokenThe caller cancellation token.
Returns
- Task<T>
The operation result.
Type Parameters
TThe result type.
Remarks
Existing implementations retain the original overload and may implement this capability explicitly.
Exceptions
- NotSupportedException
The implementation does not support token-aware execution.
ExecuteAsync<T>(Func<Task<T>>, CancellationToken)
Executes an operation with bulkhead isolation.
Task<T> ExecuteAsync<T>(Func<Task<T>> operation, CancellationToken cancellationToken)
Parameters
operationFunc<Task<T>>The delegate to execute within the bulkhead constraints.
cancellationTokenCancellationTokenA token used to observe cancellation requests.
Returns
- Task<T>
A task that completes with the asynchronous result produced by the operation.
Type Parameters
TThe type returned by the asynchronous
operation.
GetMetrics()
Gets the current bulkhead metrics.
BulkheadMetrics GetMetrics()
Returns
- BulkheadMetrics
The current BulkheadMetrics snapshot.