-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
enhancementNew feature or requestNew feature or requestfeatureThis label is in use for minor version incrementsThis label is in use for minor version increments
Milestone
Description
Title: Add resilience pipeline behaviors with Polly v8 / Microsoft.Extensions.Resilience integration
Labels: enhancement, mediator, new-package
Body:
Problem
There are no built-in retry, circuit-breaker, or timeout pipeline behaviors. In event-driven architectures (especially with Cortex.Streams and Kafka), transient failures are common and handlers that call external services need resilience patterns.
Proposed Solution
Create a Cortex.Mediator.Behaviors.Resilience package:
ResilienceCommandBehavior<TCommand, TResult>-- wraps command execution with a PollyResiliencePipelineResilienceQueryBehavior<TQuery, TResult>-- same for queries- Support per-handler resilience via
IResilientRequestinterface or[Resilient]attribute - Global default resilience pipeline via options
services.AddMediatorResilience(options =>
{
options.DefaultPipeline = new ResiliencePipelineBuilder()
.AddRetry(new RetryStrategyOptions { MaxRetryAttempts = 3 })
.AddTimeout(TimeSpan.FromSeconds(10))
.Build();
});Dependencies
Microsoft.Extensions.Resilience(which wraps Polly v8)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfeatureThis label is in use for minor version incrementsThis label is in use for minor version increments