Provides a resilient WCF client as a web service reverse proxy built on top of GenericWcfClient, featuring support for Polly's retry actions and the circuit breaker pattern.
$ dotnet add package WcfClient.ResilientProvides a resilient WCF client as a web service reverse proxy built on top of GenericWcfClient, featuring support for Polly's retry actions and the circuit breaker pattern.
builder.Services.AddWcfGenericClient<IdentityService, SoapSettings>(
config, "SoapSettings");
builder.Services.AddResilientWcfClientInstaller<IdentityService, DefaultPolicyFactory<IdentityService>>(
config, "WcfResilient");
AddWcfGenericClient: Registers the IGenericWcfClient for the IdentityService.AddResilientWcfClientInstaller: Adds resilient behavior to the GenericWcfClient (web service proxy) for the service that implements the IdentityService interface.Note: The order of these registrations in the dependency injection (DI) container is important for the correct setup of resilient behavior.
The resilient settings for the provided example:
"WcfResilient": {
"PolicyRetryAttempts": 3,
"AsyncPolicyRetryAttempts": 3,
"RetryAttemptInMilliseconds": 2000,
"AsyncRetryAttemptInMilliseconds": 2000,
"CircuitBreakerPolicyRetryAttempts": 2,
"AsyncCircuitBreakerPolicyRetryAttempts": 2,
"CircuitBreakerRetryAttemptInMilliseconds": 180000,
"AsyncCircuitBreakerRetryAttemptInMilliseconds": 180000
}
This configuration defines the number of retry attempts and the delay between retries for both synchronous and asynchronous calls, as well as the circuit breaker thresholds.