Skip to content

Provides sample implementations of the Polly library. The intent of this project is to help newcomers kick-start their use of Polly within their own projects.

License

Notifications You must be signed in to change notification settings

App-vNext/Polly-Samples

Repository files navigation

Polly-Samples

Polly logo

This repository provides sample implementations of using the Polly library in a .NET application.

The intent of this project is to help newcomers kick-start the use of Polly within their own projects.

The samples demonstrate the policies in action, against faulting endpoints.

Projects

The solution contains three applications and one class library:

flowchart LR
    console{{PollyTestClientConsole}}
    wpf{{PollyTestClientWPF}}
    lib>PollyDemos]
    api[/PollyTestWebApi\]

    console -- uses --> lib
    wpf -- uses --> lib
    lib -- invokes --> api
Loading

Demos

General information

  • The demos run against an example 'faulting server'.
    • To simulate failure, the dummy server rejects more than 3 calls in any five-second period.
  • Be sure to read the <summary> at the top of each demo.
    • This explains the intent of that demo, and what resilience it adds to its handling of the calls to the 'faulting server'.
  • Sometimes the <summary> also highlights what this demo doesn't achieve, which is often picked up in the following demo.
  • Explore the demos in sequence for best understanding.

Sequence

# Description Link
00 No strategy Code
01 Retry N times Code
02 Wait and retry N times Code
03 Wait and retry N times, N big enough to guarantee success Code
04 Wait and retry forever Code
05 Wait and retry with exponential back-off Code
06 Wait and retry nesting circuit breaker Code
07 Wait and retry chaining with circuit breaker by using Pipeline Code
08 Fallback, Retry, and CircuitBreaker in a Pipeline Code
09 Fallback, Timeout, and Retry in a Pipeline Code
10 Without isolation: Faulting calls swamp resources,
also prevent good calls
Code
11 With isolation: Faulting calls separated,
do not swamp resources, good calls still succeed
Code
12 Hedging in latency mode Code
13 Hedging in fallback mode: retry only Code
14 Hedging in fallback mode: retry with fallback Code
15 Hedging in parallel mode Code
16 Entity Framework with retry N times Code

Want further information?

Slide decks

View the slides presented at NDC, DevIntersections and other conferences.

You are welcome to use and adapt this presentation for not-for-profit presentations of Polly to co-workers, user groups and similar, subject to the condition that references to the .NET Foundation, App-vNext and the individual members of the Polly team are retained.

About

Provides sample implementations of the Polly library. The intent of this project is to help newcomers kick-start their use of Polly within their own projects.

Resources

License

Stars

Watchers

Forks

Languages