Method AddOutboundResiliencePipelines
- Namespace
- MailFathom.Infrastructure.Resilience
- Assembly
- MailFathom.Infrastructure.dll
AddOutboundResiliencePipelines(IServiceCollection, IConfiguration)
Registers the failure classifier, the pipeline of every dependency class, and the executor adapters run them through.
public static IServiceCollection AddOutboundResiliencePipelines(this IServiceCollection services, IConfiguration resilienceConfiguration)
Parameters
servicesIServiceCollectionThe service collection.
resilienceConfigurationIConfigurationThe
Resilienceconfiguration section, whose children are named after OutboundDependency members.
Returns
- IServiceCollection
The service collection, for chaining.
Remarks
Each class is bound as named options, so a deployment names only the limits it disagrees with and the rest come from the class defaults. Binding is strict: a misspelled key would otherwise be ignored and leave the operator convinced they had tuned a limit that never moved.
A budget is read once, at startup. The settings are restart-required: a reloaded candidate is not adopted, and a malformed one cannot disturb a pipeline that is already serving. Tuning a dependency therefore needs a restart, but never a rebuild.
This registration covers non-HTTP dependencies only. HttpClient traffic is already wrapped once by the
standard resilience handler in the host's service defaults, and adding a pipeline around an HTTP-based
provider client would place two retry layers on one call.
One builder is registered per dependency class and the registry builds a pipeline per MailFathom.Infrastructure.Resilience.OutboundPipelineKey from it, so a class that talks to several remote instances gets one pipeline — and therefore one circuit-breaker and one concurrency budget — per instance without any additional configuration.
Exceptions
- ArgumentNullException
Thrown when
servicesorresilienceConfigurationis null.