You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-13Lines changed: 32 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,14 +40,26 @@ In addition to the detailed pages on each policy, an [introduction to the role o
40
40
41
41
For using Polly with HttpClient factory from ASPNET Core 2.1, see our [detailed wiki page](https://github.com/App-vNext/Polly/wiki/Polly-and-HttpClientFactory), then come back here or [explore the wiki](https://github.com/App-vNext/Polly/wiki) to learn more about the operation of each policy.
42
42
43
-
# Usage – fault-handling policies
43
+
### Release notes
44
+
45
+
+ The [change log](https://github.com/App-vNext/Polly/blob/master/CHANGELOG.md) describes changes by release.
46
+
+ We tag Pull Requests and Issues with [milestones](https://github.com/App-vNext/Polly/milestones) which match to nuget package release numbers.
47
+
+ Breaking changes are called out in the wiki ([v7](https://github.com/App-vNext/Polly/wiki/Polly-v7-breaking-changes) ; [v6](https://github.com/App-vNext/Polly/wiki/Polly-v6-breaking-changes)) with simple notes on any necessary steps to upgrade.
48
+
49
+
### Supported targets
50
+
51
+
For details of supported compilation targets by version, see the [supported targets](https://github.com/App-vNext/Polly/wiki/Supported-targets) grid.
52
+
53
+
### Role of the readme and the wiki
54
+
55
+
This ReadMe aims to give a quick overview of all Polly features - including enough to get you started with any policy. For deeper detail on any policy, and many other aspects of Polly, be sure also to check out the [wiki documentation](https://github.com/App-vNext/Polly/wiki).
56
+
57
+
# Usage – fault-handling, reactive policies
44
58
45
59
Fault-handling policies handle specific exceptions thrown by, or results returned by, the delegates you execute through the policy.
46
60
47
61
## Step 1 : Specify the exceptions/faults you want the policy to handle
48
62
49
-
### (for fault-handling policies: Retry family, CircuitBreaker family and Fallback)
50
-
51
63
```csharp
52
64
// Single exception type
53
65
Policy
@@ -359,9 +371,11 @@ breaker.Reset();
359
371
360
372
```
361
373
374
+
Circuit-breaker policies block exceptions by throwing `BrokenCircuitException` when the circuit is broken. See: [Circuit-Breaker documentation on wiki](https://github.com/App-vNext/Polly/wiki/Circuit-Breaker).
375
+
362
376
Note that circuit-breaker policies [rethrow all exceptions](https://github.com/App-vNext/Polly/wiki/Circuit-Breaker#exception-handling), even handled ones. A circuit-breaker exists to measure faults and break the circuit when too many faults occur, but does not orchestrate retries. Combine a circuit-breaker with a retry policy as needed.
363
377
364
-
For more depth see also: [Circuit-Breaker documentation on wiki](https://github.com/App-vNext/Polly/wiki/Circuit-Breaker).
378
+
365
379
366
380
### Advanced Circuit Breaker
367
381
```csharp
@@ -473,9 +487,9 @@ Policy
473
487
474
488
The above examples show policy definition immediately followed by policy execution, for simplicity. Policy definition and execution may just as often be separated in the codebase and application lifecycle. You may choose for example to define policies on start-up, then provide them to point-of-use by dependency injection (perhaps using [`PolicyRegistry`](#policyregistry)).
475
489
476
-
# Usage –general resilience policies
490
+
# Usage –proactive policies
477
491
478
-
The general resilience policies add resilience strategies that are not explicitly centred around handling faults which delegates may throw or return.
492
+
The proactive policies add resilience strategies that not based on handling faults which delegates may throw or return.
479
493
480
494
## Step 1 : Configure
481
495
@@ -556,6 +570,8 @@ var response = await timeoutPolicy
556
570
);
557
571
```
558
572
573
+
Timeout policies throw `TimeoutRejectedException` when timeout occurs.
574
+
559
575
For more detail see: [Timeout policy documentation](https://github.com/App-vNext/Polly/wiki/Timeout) on wiki.
560
576
561
577
### Bulkhead
@@ -585,6 +601,8 @@ int freeQueueSlots = bulkhead.QueueAvailableCount;
585
601
586
602
```
587
603
604
+
Bulkhead policies throw `BulkheadRejectedException` if items are queued to the bulkhead when the bulkhead execution and queue are both full.
605
+
588
606
589
607
For more detail see: [Bulkhead policy documentation](https://github.com/App-vNext/Polly/wiki/Bulkhead) on wiki.
590
608
@@ -920,12 +938,6 @@ This allows collections of similar kinds of policy to be treated as one - for ex
920
938
921
939
Formoredetailsee: [Pollyandinterfaces](https://github.com/App-vNext/Polly/wiki/Polly-and-interfaces) on wiki.
922
940
923
-
# Release notes
924
-
925
-
Fordetailsofchangesbyreleaseseethe [changelog](https://github.com/App-vNext/Polly/blob/master/CHANGELOG.md). We also tag relevant Pull Requests and Issues with [milestones](https://github.com/App-vNext/Polly/milestones), which match to nuget package release numbers.
926
-
927
-
Forfulldetailedofsupportedtargetsbyversion, see [supportedtargets](https://github.com/App-vNext/Polly/wiki/Supported-targets).
928
-
929
941
# 3rd Party Libraries and Contributions
930
942
931
943
* [FluentAssertions](https://github.com/fluentassertions/fluentassertions) - A set of .NET extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style test | [Apache License 2.0 (Apache)](https://github.com/dennisdoomen/fluentassertions/blob/develop/LICENSE)
@@ -994,6 +1006,11 @@ For full detailed of supported targets by version, see [supported targets](https
994
1006
* [@freakazoid182](https://github.com/Freakazoid182) - WaitAnd/RetryForever overloads where onRetry takes the retry number as a parameter.
995
1007
* [@dustyhoppe](https://github.com/dustyhoppe) - Overloads where onTimeout takes thrown exception as a parameter.
* [@reisenberger](https://github.com/reisenberger) - Clarify separation of sync and async policies.
1010
+
* [@reisenberger](https://github.com/reisenberger) - Enable extensibility by custom policies hosted external to Polly.
1011
+
* [@seanfarrow](https://github.com/SeanFarrow) - Enable collection initialization syntax for PolicyRegistry.
1012
+
* [@moerwald](https://github.com/moerwald) - Code clean-ups, usage of more concise C# members.
1013
+
* [@cmeeren](https://github.com/cmeeren) - Enable cache policies to cache values of default(TResult).
997
1014
998
1015
# Sample Projects
999
1016
@@ -1003,7 +1020,9 @@ For full detailed of supported targets by version, see [supported targets](https
1003
1020
1004
1021
# Instructions for Contributing
1005
1022
1006
-
Pleasecheckoutour [Wiki](https://github.com/App-vNext/Polly/wiki/Git-Workflow) for contributing guidelines. We are following the excellent GitHub Flow process, and would like to make sure you have all of the information needed to be a world-class contributor!
Forgithubworkflow, checkoutour [Wiki](https://github.com/App-vNext/Polly/wiki/Git-Workflow). We are following the excellent GitHub Flow process, and would like to make sure you have all of the information needed to be a world-class contributor!
1007
1026
1008
1027
SincePollyispartofthe .NETFoundation, weaskourcontributorstoabidebytheir [CodeofConduct](https://www.dotnetfoundation.org/code-of-conduct). To contribute (beyond trivial typo corrections), review and sign the [.Net Foundation Contributor License Agreement](https://cla.dotnetfoundation.org/). This ensures the community is free to use your contributions. The registration process can be completed entirely online.
0 commit comments