Skip to content
项目

关于

提供 Polly 库的示例实现,旨在帮助新手快速开始在自己的项目中使用 Polly。

开发工具

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
-1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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

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.

探索相关项目

加载中…