项目作者: enmanuellopez02

项目描述 :
Implement resistance and handling of transient faults such as time out, repetition and broken circuit. in your applications
高级语言: C#
项目地址: git://github.com/enmanuellopez02/Evospike.PollyWithRetryAndCircuitBreaker.git


Polly With Retry And Circuit Breaker

Implement resistance and handling of transient faults such as time out, repetition and broken circuit. in your applications

add configuration extension method

  1. public void ConfigureServices(IServiceCollection services)
  2. {
  3. services.AddHttpClient<ExampleClient>(client =>
  4. {
  5. client.BaseAddress = new Uri("https://localhost:5001");
  6. })
  7. .AddPollyWithRetryAndCircuitBreaker(services); //CODE HERE
  8. services.AddControllers();
  9. }

WaitAndRetry

Standby time: 5

Retry Attempt: 0s, 2s, 4s, 8s, 16s

OnRetry: has LogWarning

CircuitBreaker

Allowed before: 3

Duration of break: 15s

OnBreak: has LogWarning

OnReset: has LogWarning

All problems presented during the application can be viewed in your log system