Skip to main content
Table of Contents

Class ResilienceServiceCollectionExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
Stratara.Resilience.dll

DI extensions for Stratara's named Polly resilience pipelines.

public static class ResilienceServiceCollectionExtensions
Inheritance
ResilienceServiceCollectionExtensions
Inherited Members

Methods

AddResiliencePipelines(IServiceCollection)

Register every Stratara named resilience pipeline (MessageBus, CommandDispatcher, EventBundleDispatcher, ConcurrencyConflict, PrecedingFact, ProjectionReplayBatch) with the application's Polly registry.

public static IServiceCollection AddResiliencePipelines(this IServiceCollection services)

Parameters

services IServiceCollection

The service collection to mutate.

Returns

IServiceCollection

The same service collection, to enable chaining.

Examples

Registers the named pipelines. Reference them through ResilienceNames rather than by string literal:

services.AddResiliencePipelines();

Remarks

Idempotent — subsequent calls re-register the same pipelines, which Polly tolerates by keeping the first registration. Resolve a pipeline at the call site via sp.GetRequiredService<ResiliencePipelineProvider<string>>().GetPipeline(name).