{"id":18924615,"url":"https://github.com/app-vnext/polly-samples","last_synced_at":"2025-05-16T01:05:34.775Z","repository":{"id":42376274,"uuid":"47483221","full_name":"App-vNext/Polly-Samples","owner":"App-vNext","description":"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.","archived":false,"fork":false,"pushed_at":"2025-05-15T16:44:57.000Z","size":27525,"stargazers_count":293,"open_issues_count":1,"forks_count":129,"subscribers_count":27,"default_branch":"main","last_synced_at":"2025-05-15T17:47:32.779Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/App-vNext.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-12-06T04:13:30.000Z","updated_at":"2025-05-15T16:44:57.000Z","dependencies_parsed_at":"2024-11-22T13:02:23.038Z","dependency_job_id":"7ff8be46-4d0a-4527-b0bd-80179028bbbc","html_url":"https://github.com/App-vNext/Polly-Samples","commit_stats":{"total_commits":139,"total_committers":11,"mean_commits":"12.636363636363637","dds":0.7122302158273381,"last_synced_commit":"4a2c9826efc8250e3fad6bcfea42c1fc0bba6bca"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/App-vNext%2FPolly-Samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/App-vNext%2FPolly-Samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/App-vNext%2FPolly-Samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/App-vNext%2FPolly-Samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/App-vNext","download_url":"https://codeload.github.com/App-vNext/Polly-Samples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448579,"owners_count":22072764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T11:07:24.496Z","updated_at":"2025-05-16T01:05:29.752Z","avatar_url":"https://github.com/App-vNext.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Polly-Samples\n\n![Polly logo](https://raw.github.com/App-vNext/Polly/main/Polly-Logo.png)\n\nThis repository provides sample implementations of using the [Polly library](https://www.github.com/App-vNext/Polly) in a .NET application.\n\nThe intent of this project is to help newcomers kick-start the use of Polly within their own projects.\n\nThe samples demonstrate the policies in action, against faulting endpoints.\n\n## Projects\n\nThe solution contains three applications and one class library:\n- `PollyTestWebApi`: This application is a web API with several endpoints. ([Further information](/PollyTestWebApi/README.md))\n- `PollyDemos`: This library contains the Polly demos. ([Further information](/PollyDemos/README.md))\n- `PollyTestClientConsole`: This application provides a CLI to walk through the demos. ([Further information](/PollyTestClientConsole/README.md))\n- `PollyTestClientWpf`: This application provides a GUI to walk through the demos. ([Further information](/PollyTestClientWpf/README.md))\n\n```mermaid\nflowchart LR\n    console{{PollyTestClientConsole}}\n    wpf{{PollyTestClientWPF}}\n    lib\u003ePollyDemos]\n    api[/PollyTestWebApi\\]\n\n    console -- uses --\u003e lib\n    wpf -- uses --\u003e lib\n    lib -- invokes --\u003e api\n```\n\n## Demos\n\n### General information\n\n- The demos run against an example 'faulting server'.\n  - To simulate failure, the dummy server rejects more than 3 calls in any five-second period.\n- Be sure to read the `\u003csummary\u003e` at the top of each demo.\n  - This explains the intent of that demo, and what resilience it adds to its handling of the calls to the 'faulting server'.\n- Sometimes the `\u003csummary\u003e` also highlights what this demo _doesn't_ achieve, which is often picked up in the following demo.\n- Explore the demos in sequence for best understanding.\n\n### Sequence\n\n| # | Description | Link |\n| :-: | -- | :-: |\n| 00 | No strategy | [Code](PollyDemos/Demo00_NoStrategy.cs) |\n| 01 | Retry N times | [Code](PollyDemos/Demo01_RetryNTimes.cs) |\n| 02 | Wait and retry N times | [Code](PollyDemos/Demo02_WaitAndRetryNTimes.cs) |\n| 03 | Wait and retry N times, N big enough to guarantee success | [Code](PollyDemos/Demo03_WaitAndRetryNTimes_WithEnoughRetries.cs) |\n| 04 | Wait and retry forever | [Code](PollyDemos/Demo04_WaitAndRetryForever.cs) |\n| 05 | Wait and retry with exponential back-off | [Code](PollyDemos/Demo05_WaitAndRetryWithExponentialBackoff.cs) |\n| 06 | Wait and retry nesting circuit breaker | [Code](PollyDemos/Demo06_WaitAndRetryNestingCircuitBreaker.cs) |\n| 07 | Wait and retry chaining with circuit breaker by using Pipeline | [Code](PollyDemos/Demo07_WaitAndRetryNestingCircuitBreakerUsingPipeline.cs) |\n| 08 | Fallback, Retry, and CircuitBreaker in a Pipeline | [Code](PollyDemos/Demo08_Pipeline-Fallback-WaitAndRetry-CircuitBreaker.cs) |\n| 09 | Fallback, Timeout, and Retry in a Pipeline | [Code](PollyDemos/Demo09_Pipeline-Fallback-Timeout-WaitAndRetry.cs) |\n| 10 | Without isolation: Faulting calls swamp resources, \u003cbr/\u003ealso prevent good calls | [Code](PollyDemos/Demo10_SharedConcurrencyLimiter.cs) |\n| 11 | With isolation: Faulting calls separated, \u003cbr/\u003edo not swamp resources, good calls still succeed | [Code](PollyDemos/Demo11_MultipleConcurrencyLimiters.cs) |\n| 12 | Hedging in latency mode | [Code](PollyDemos/Demo12_LatencyHedging.cs) |\n| 13 | Hedging in fallback mode: retry only | [Code](PollyDemos/Demo13_FallbackHedging-RetryOnly.cs) |\n| 14 | Hedging in fallback mode: retry with fallback | [Code](PollyDemos/Demo14_FallbackHedging-RetryWithFallback.cs) |\n| 15 | Hedging in parallel mode | [Code](PollyDemos/Demo15_ParallelHedging.cs) |\n| 16 | Entity Framework with retry N times | [Code](PollyDemos/Demo16_EntityFramework-WithRetryNTimes.cs) |\n\n## Want further information?\n\n- For any questions about the operation of the demos, ask on this repo [with an issue](https://github.com/App-vNext/Polly-Samples/issues/new/choose).\n- For any questions about Polly, ask in the [Polly repository](https://www.github.com/App-vNext/Polly/issues/new/choose).\n- For full Polly syntax, see [Polly repository]((https://github.com/App-vNext/Polly#readme)) and the [Polly documentation](https://www.pollydocs.org/).\n\n## Slide decks\n\nView the [slides presented](./slides/AppvNext-DotNetFoundation-Polly-DemoSlides-Nov-2019-generic.pptx) at NDC, DevIntersections and other conferences.\n\nYou 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapp-vnext%2Fpolly-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapp-vnext%2Fpolly-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapp-vnext%2Fpolly-samples/lists"}