Class WorkflowOperationPollyExtensions
- Namespace
- WorkflowForge.Extensions.Resilience.Polly
- Assembly
- WorkflowForge.Extensions.Resilience.Polly.dll
Extension methods for easily wrapping operations with Polly resilience.
public static class WorkflowOperationPollyExtensions
- Inheritance
-
WorkflowOperationPollyExtensions
- Inherited Members
Methods
WithPollyCircuitBreaker(IWorkflowOperation, int, TimeSpan?, IWorkflowForgeLogger?)
Wraps an operation with Polly circuit breaker policy.
public static PollyRetryOperation WithPollyCircuitBreaker(this IWorkflowOperation operation, int failureThreshold = 5, TimeSpan? durationOfBreak = null, IWorkflowForgeLogger? logger = null)
Parameters
operationIWorkflowOperationThe operation to wrap.
failureThresholdintFailure threshold before opening.
durationOfBreakTimeSpan?Duration to keep circuit open.
loggerIWorkflowForgeLoggerOptional logger.
Returns
- PollyRetryOperation
A Polly-wrapped operation.
WithPollyComprehensive(IWorkflowOperation, PollyMiddlewareOptions, IWorkflowForgeLogger?)
Wraps an operation with comprehensive Polly policies.
public static PollyRetryOperation WithPollyComprehensive(this IWorkflowOperation operation, PollyMiddlewareOptions settings, IWorkflowForgeLogger? logger = null)
Parameters
operationIWorkflowOperationThe operation to wrap.
settingsPollyMiddlewareOptionsPolly settings configuration.
loggerIWorkflowForgeLoggerOptional logger.
Returns
- PollyRetryOperation
A comprehensively protected Polly-wrapped operation.
WithPollyRetry(IWorkflowOperation, int, TimeSpan?, TimeSpan?, IWorkflowForgeLogger?)
Wraps an operation with Polly retry policy.
public static PollyRetryOperation WithPollyRetry(this IWorkflowOperation operation, int maxRetryAttempts = 3, TimeSpan? baseDelay = null, TimeSpan? maxDelay = null, IWorkflowForgeLogger? logger = null)
Parameters
operationIWorkflowOperationThe operation to wrap.
maxRetryAttemptsintMaximum retry attempts.
baseDelayTimeSpan?Base delay for exponential backoff.
maxDelayTimeSpan?Maximum delay between retries.
loggerIWorkflowForgeLoggerOptional logger.
Returns
- PollyRetryOperation
A Polly-wrapped operation.