![]() |
VOOZH | about |
dotnet add package Franz.Common.Mediator.Polly --version 2.2.7
NuGet\Install-Package Franz.Common.Mediator.Polly -Version 2.2.7
<PackageReference Include="Franz.Common.Mediator.Polly" Version="2.2.7" />
<PackageVersion Include="Franz.Common.Mediator.Polly" Version="2.2.7" />Directory.Packages.props
<PackageReference Include="Franz.Common.Mediator.Polly" />Project file
paket add Franz.Common.Mediator.Polly --version 2.2.7
#r "nuget: Franz.Common.Mediator.Polly, 2.2.7"
#:package Franz.Common.Mediator.Polly@2.2.7
#addin nuget:?package=Franz.Common.Mediator.Polly&version=2.2.7Install as a Cake Addin
#tool nuget:?package=Franz.Common.Mediator.Polly&version=2.2.7Install as a Cake Tool
Franz.Common.Mediator.Polly extends Franz.Common.Mediator with Polly-based resilience pipelines. It gives you retry, circuit breaker, advanced circuit breaker, timeout, and bulkhead isolation for Mediator requests — all with enriched Serilog logging, context-awareness, and resilience telemetry built-in.
⚡ No extra wiring. No boilerplate. Just plug it in.
Polly, Serilog, Franz.Common.Mediator🔁 Retry Pipeline — automatic retries with backoff & correlated telemetry.
🚦 Circuit Breaker Pipeline — prevents cascading failures under load.
📊 Advanced Circuit Breaker Pipeline — trips based on failure ratio in rolling window.
⏱ Timeout Pipeline — cancels long-running requests automatically.
📦 Bulkhead Pipeline — limits concurrent requests and queue pressure.
🧠 ResilienceContext — shared state across all resilience pipelines:
RetryCount, CircuitOpen, TimeoutOccurred, BulkheadRejected, Duration👁 IResilienceObserver — extensibility hooks for external telemetry, alerts, or dashboards.
📝 Enriched Serilog Logging — all logs include:
dotnet add package Franz.Common.Mediator.Polly
From v1.6.2, resilience is now config-driven.
Define your policies in appsettings.json:
"Resilience": {
"RetryPolicy": {
"Enabled": true,
"RetryCount": 3,
"RetryIntervalMilliseconds": 500
},
"CircuitBreaker": {
"Enabled": true,
"FailureThreshold": 0.5,
"MinimumThroughput": 10,
"DurationOfBreakSeconds": 30
},
"TimeoutPolicy": {
"Enabled": true,
"TimeoutSeconds": 5
},
"BulkheadPolicy": {
"Enabled": true,
"MaxParallelization": 10,
"MaxQueueSize": 20
}
}
Then just call:
builder.Services.AddFranzResilience(builder.Configuration);
✅ That’s it — retry, circuit breaker, timeout, and bulkhead are auto-registered from config and wired into Mediator pipelines.
✅ Each policy injects structured logs and updates the ResilienceContext.
If you prefer explicit registration:
using Franz.Common.Mediator.Polly;
builder.Services.AddFranzPollyPolicies(options =>
{
options.AddRetry("DefaultRetry", retryCount: 3, intervalMs: 500);
options.AddCircuitBreaker("DefaultCircuitBreaker", 0.5, 10, 30);
options.AddTimeout("DefaultTimeout", 5);
options.AddBulkhead("DefaultBulkhead", 10, 20);
});
builder.Services
.AddFranzPollyRetry("DefaultRetry")
.AddFranzPollyCircuitBreaker("DefaultCircuitBreaker")
.AddFranzPollyTimeout("DefaultTimeout")
.AddFranzPollyBulkhead("DefaultBulkhead");
Version 1.6.14 introduces a resilience-awareness layer across all Mediator pipelines.
ResilienceContextCarries runtime state between pipelines:
public sealed class ResilienceContext
{
public string PolicyName { get; init; } = string.Empty;
public int RetryCount { get; set; }
public bool CircuitOpen { get; set; }
public bool TimeoutOccurred { get; set; }
public bool BulkheadRejected { get; set; }
public TimeSpan Duration { get; set; }
public DateTimeOffset Timestamp { get; } = DateTimeOffset.UtcNow;
public bool IsHealthy => !CircuitOpen && !TimeoutOccurred && !BulkheadRejected;
}
Each pipeline updates this context and emits structured logs through Serilog.
IResilienceObserverObservers can listen to policy outcomes globally:
public interface IResilienceObserver
{
void OnPolicyExecuted(string policyName, ResilienceContext context);
}
You can implement custom observers for metrics or telemetry (e.g., Application Insights, Prometheus, Elastic APM).
Example:
public sealed class ElasticResilienceObserver : IResilienceObserver
{
private readonly ILogger<ElasticResilienceObserver> _logger;
public ElasticResilienceObserver(ILogger<ElasticResilienceObserver> logger)
=> _logger = logger;
public void OnPolicyExecuted(string policyName, ResilienceContext context)
=> _logger.LogInformation("🧠 {Policy} -> Healthy={Healthy} Duration={Duration}ms Retries={RetryCount}",
policyName, context.IsHealthy, context.Duration.TotalMilliseconds, context.RetryCount);
}
Register it once:
builder.Services.AddSingleton<IResilienceObserver, ElasticResilienceObserver>();
| Pipeline | Options Class | Key | Observes Context |
|---|---|---|---|
| Retry | PollyRetryPipelineOptions |
"RetryPolicy" |
✅ |
| Circuit Breaker | PollyCircuitBreakerPipelineOptions |
"CircuitBreaker" |
✅ |
| Advanced Circuit Breaker | PollyAdvancedCircuitBreakerOptions |
"AdvancedCircuitBreaker" |
✅ |
| Timeout | PollyTimeoutPipelineOptions |
"TimeoutPolicy" |
✅ |
| Bulkhead | PollyBulkheadPipelineOptions |
"BulkheadPolicy" |
✅ |
All pipelines automatically participate in Franz’s logging & correlation system.
[12:01:22 INF] ▶️ Executing GetBookQuery [abc123] with RetryPolicy
[12:01:22 INF] ✅ GetBookQuery [abc123] succeeded after 47ms (policy RetryPolicy, retries=0)
[12:01:25 WRN] 🔁 GetBookQuery [abc123] retry attempt 2 (policy RetryPolicy)
[12:01:25 ERR] ⏱️ GetBookQuery [abc123] timed out after 5s (policy TimeoutPolicy)
[12:01:27 ERR] ❌ GetBookQuery [abc123] failed after 3 retries (policy RetryPolicy)
[12:01:27 WRN] 🚦 Circuit opened for 30s (policy CircuitBreaker)
FranzResilienceSummaryPipeline — emits aggregated resilience telemetry per request.ResilienceContext — unified runtime state for all pipelines.IResilienceObserver for external resilience monitoring.AddFranzResilience(IConfiguration) for config-driven resilience.⚡ With Franz.Common.Mediator.Polly, resilience is first-class, observable, and deterministic.
Configure it once — and your Mediator pipelines automatically enforce retries, timeouts, bulkheads, and breakers with total visibility.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Franz.Common.Mediator.Polly:
| Package | Downloads |
|---|---|
|
Franz.Common.Messaging.AzureEventBus
Shared utility library for the Franz Framework. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.2.7 | 114 | 6/7/2026 |
| 2.2.6 | 117 | 6/6/2026 |
| 2.2.5 | 122 | 6/4/2026 |
| 2.2.4 | 119 | 6/3/2026 |
| 2.2.3 | 113 | 6/2/2026 |
| 2.2.2 | 122 | 6/2/2026 |
| 2.2.1 | 115 | 5/24/2026 |
| 2.1.4 | 109 | 4/27/2026 |
| 2.1.3 | 112 | 4/26/2026 |
| 2.1.2 | 115 | 4/26/2026 |
| 2.1.1 | 119 | 4/22/2026 |
| 2.0.2 | 125 | 3/30/2026 |
| 2.0.1 | 129 | 3/29/2026 |
| 1.7.8 | 131 | 3/2/2026 |
| 1.7.7 | 138 | 1/31/2026 |
| 1.7.6 | 145 | 1/22/2026 |
| 1.7.5 | 140 | 1/10/2026 |
| 1.7.4 | 136 | 12/27/2025 |
| 1.7.3 | 215 | 12/22/2025 |
| 1.7.2 | 227 | 12/21/2025 |