Polly 5.5.0

Polly is a .NET 4.5 / .NET Standard 1.1 library that allows developers to express resilience and transient fault handling policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation and Fallback in a fluent and thread-safe manner.

There is a newer version of this package available.
See the version list below for details.
Install-Package Polly -Version 5.5.0
dotnet add package Polly --version 5.5.0
<PackageReference Include="Polly" Version="5.5.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Polly --version 5.5.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

v5.0 is a major release with significant new resilience policies: Timeout; Bulkhead Isolation; Fallback; Cache; and PolicyWrap.  See release notes back to v5.0.0 for full details.  v5.0.5 includes important circuit-breaker fixes.

    5.5.0
    ---------------------
    - Bug fix: non-generic CachePolicy with PolicyWrap
    - Add Cache interfaces
    
    5.4.0
    ---------------------
    - Add CachePolicy: cache-aside pattern, with interfaces for pluggable cache providers and serializers.
    - Bug fix: Sync TimeoutPolicy in pessimistic mode no longer interposes AggregateException.
    - Provide public factory methods for PolicyResult, to support testing.
    - Fallback delegates can now take handled fault as input parameter.

    5.3.1
    ---------------------
    - Make ISyncPolicy<TResult> public
    - (Upgrade solution to msbuild15)

    5.3.0
    ---------------------
    - Fix ExecuteAndCapture() usage with PolicyWrap   
    - Allow Fallback delegates to take execution Context
    - Provide IReadOnlyPolicyRegistry interface

    5.2.0
    ---------------------
    - Add PolicyRegistry for storing and retrieving policies.
    - Add interfaces by policy type and execution type.
    - Change .NetStandard minimum support to NetStandard1.1.

    5.1.0
    ---------------------
    - Allow different parts of a policy execution to exchange data via a mutable Context travelling with each execution.

    5.0.6
    ---------------------
    - Update NETStandard.Library dependency to latest 1.6.1 for .NetStandard1.0 target.  Resolves compatibility for some Xamarin targets.

    5.0.5
    ---------------------
    - Bug fix: Prevent request stampede during half-open state of CircuitBreaker and AdvancedCircuitBreaker.  Enforce only one new trial call per break duration, during half-open state.
    - Bug fix: Prevent duplicate raising of the onBreak delegate, if executions started when a circuit was closed, return faults when a circuit has already opened.
    - Optimisation: Optimise hotpaths for Circuit-Breaker, Retry and Fallback policies.
    - Add NoOpPolicy: NoOpPolicy executes delegates without intervention; for eg stubbing out Polly in unit testing.

    5.0.4 pre
    ---------------------
    - (.NET40Async package changes only)

    5.0.3 RTM
    ---------------------
    - Refine implementation of cancellable synchronous WaitAndRetry
    - Minor breaking change: Where a user delegate does not observe cancellation, Polly will now honour the delegate's outcome rather than throw for the unobserved cancellation (issue 188).

    5.0.2 alpha
    ---------------------
    - .NETStandard1.0 target: Correctly state dependencies.
    - .NETStandard1.0 target: Fix SemVer stamping of Polly.dll.
    - PCL259 project and target: Remove, in favour of .NETStandard1.0 target.  PCL259 targets are still supported, via .NETStandard1.0 target.
    - Mark Polly.dll as CLSCompliant.
    
    5.0.1 alpha
    ---------------------
    - Add a .NETStandard1.0 target.

    5.0.0 alpha
    ---------------------
    A major release, adding significant new resilience policies:
    - Timeout policy: allows timing out any execution
    - Bulkhead isolation policy: limits the resources consumable by governed actions, such that a faulting channel cannot cause cascading failures.
    - Fallback policy: provides for a fallback execution or value, in case of overall failure
    - PolicyWrap: allows flexibly combining Policy instances of any type, to form an overall resilience strategy.

    Other changes include:
    - Add PolicyKeys and context to all policy executions, for logging and to support later introduction of policy events and metrics.
    - Add CancellationToken support to synchronous executions.
    - Add some missing ExecuteAndCapture/Async overloads.
    - Remove invalid ExecuteAsync overloads taking (but not making use of) a CancellationToken
    - Provide .NET4.0 support uniquely through Polly.NET40Async package
    - Retire ContextualPolicy (not part of documented API; support now in Policy base class)
    - Discontinue .NET3.5 support

    4.3.0
    ---------------------
    - Added ability for policies to handle return results.  Optimised circuit-breaker hot path.  Fixed circuit-breaker threshold bug.  
    
    4.2.4
    ---------------------
    - Added overloads to WaitAndRetry and WaitAndRetryAsync methods that accept an onRetry delegate which includes the attempt count.
    
    4.2.3
    ---------------------
    - Cleaned up new Polly.Net40Async NuGet package, removing Polly.dll and unused framework folders.
    
    4.2.2
    ---------------------
    - Add new Polly.Net40Async project supporting async for .NET40 via Microsoft.Bcl.Async.  This is available as separate Nuget packages Polly.Net40Async and Polly.Net40Async-signed.

    4.2.1
    ---------------------
    - Allowed async onRetry delegates to async retry policies.

    4.2.0
    ---------------------
    - Added AdvancedCircuitBreaker - Thanks to @reisenberger and @kristianhald
    
    4.1.2
    ---------------------
    - Fixed an issue with the onReset delegate of the CircuitBreaker.
    
    4.1.1
    ---------------------
    - Add ExecuteAndCapture support with arbitrary context data - Thanks to @reisenberger
    
    4.1.0
    ---------------------
    - Add Wait and retry forever policy - Thanks to @nedstoyanov
    - Remove time-limit on CircuitBreaker state-change delegates - Thanks to @reisenberger
    
    4.0.0
    ---------------------
    - Add async support and circuit-breaker support for ContextualPolicy
    - Add manual control of circuit-breaker (reset and manual circuit isolation)
    - Add public reporting of circuit-breaker state, for health/performance monitoring
    - Add delegates on changes of circuit state - Thanks to @reisenberger
    
    3.0.0
    ---------------------
    - Add cancellation support for all async Policy execution - Thanks to @reisenberger
    
    2.2.7
    ---------------------
    - Fixes an issue where continueOnCapturedContext needed to be specified in two places (on action execution and Policy configuration), when wanting to flow async action execution on the captured context - Thanks to @reisenberger
    - Fixes excess line ending issues
    
    2.2.6
    ---------------------
    - Async sleep fix, plus added continueOnCapturedContext parameter on async methods to control whether continuation and retry will run on captured synchronization context - Thanks to @yevhen
    
    2.2.5
    ---------------------
    - Policies with a retry count of zero are now allowed
    
    2.2.4
    ---------------------
    - Add .NET Core support
    
    2.2.3
    ---------------------
    - Fix PCL implementation of `SystemClock.Reset`
    - Added ability to capture the results of executing a policy via `ExecuteAndCapture`
    
    2.2.2
    ---------------------
    - Added extra `NotOnCapturedContext` call to prevent potential deadlocks when blocking on asynchronous calls
    
    2.2.1
    ---------------------
    - Replaced non-blocking sleep implementation with a blocking one for PCL
    
    2.2.0
    ---------------------
    - Added Async Support (PCL)
    - PCL Profile updated from Profile78 ->  Profile 259
    - Added missing WaitAndRetryAsync overload
    
    2.1.0
    ---------------------
    - Added Async Support (.NET Framework 4.5 Only)
    
    2.0.0
    ---------------------
    - Added Portable Class Library
    - The "Polly" NuGet package is now no longer strongly named. The strongly named NuGet package is now "Polly-Signed"
    
    1.1.0
    ---------------------
    - Added additional overloads to Retry
    - Allow arbitrary data to be passed to policy execution

Showing the top 10 GitHub repositories that depend on Polly:

Repository Stars
dotnet-architecture/eShopOnContainers
Easy to get started sample reference microservice and container based application. Cross-platform on Linux and Windows Docker Containers, powered by .NET Core 2.2, Docker engine and optionally Azure, Kubernetes or Service Fabric. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor.
dotnet/orleans
Orleans is a cross-platform framework for building distributed applications with .NET
microsoft/ailab
Experience, Learn and Code the latest breakthrough innovations with Microsoft AI
ThreeMammals/Ocelot
.NET core API Gateway
dotnetcore/surging
Surging is a micro-service engine that provides a lightweight, high-performance, modular RPC request pipeline. The service engine supports http, TCP, WS,Grpc, Mqtt, UDP, and DNS protocols. It uses ZooKeeper and Consul as a registry, and integrates it. Hash, random, polling, Fair Polling as a load balancing algorithm, built-in service governance to ensure reliable RPC communication, the engine contains Diagnostic, link tracking for protocol and middleware calls, and integration SkyWalking Distributed APM
JosefNemec/Playnite
Open source video game library manager with support for 3rd party libraries like Steam, GOG, Origin, Battle.net and Uplay. Including game emulation support, providing one unified interface for your games.
tidusjar/Ombi
Want a Movie or TV Show on Plex or Emby? Use Ombi!
Azure/azure-sdk-for-net
Microsoft Azure SDK for .NET
BrighterCommand/Brighter
Command Dispatcher, Processor, and Distributed Task Queue
Wyamio/Wyam
A modular static content and static site generator.

Version History

Version Downloads Last updated
7.1.1 346,900 9/2/2019
7.1.0 3,197,255 3/13/2019
7.0.3 382,724 2/21/2019
7.0.2 215,685 2/11/2019
7.0.1 33,512 2/9/2019
6.1.2 1,906,312 11/27/2018
6.1.1 407,770 11/12/2018
6.1.0 2,794,390 7/15/2018
6.0.1 4,137,076 5/6/2018
6.0.0-v6alpha0001 4,220 5/3/2018
5.9.0 1,085,973 4/9/2018
5.8.0 1,480,689 1/31/2018
5.7.0 347,968 1/6/2018
5.6.1 520,367 11/29/2017
5.6.0 64,246 11/27/2017
5.5.0 413,684 11/3/2017
5.4.0 45,931 11/1/2017
5.3.1 998,762 8/6/2017
5.3.0 127,740 7/27/2017
5.2.0 231,630 6/28/2017
5.1.1-v5-x-cachealpha0001 50,930 6/2/2017
5.1.0 447,502 5/4/2017
5.0.6 476,759 2/11/2017
5.0.5 233,097 2/4/2017
5.0.3 162,453 1/6/2017
5.0.2-v5-0-alpha0001 12,581 11/22/2016
5.0.1-v5-0-alpha0001 13,860 10/25/2016
4.5.0-beta-netstandar-0001 24,139 9/6/2016
4.3.0 1,181,353 6/30/2016
4.2.4 27,086 6/17/2016
4.2.3 23,919 6/7/2016
4.2.2 9,516 6/2/2016
4.2.1 74,120 5/26/2016
4.2.0 94,449 4/14/2016
4.1.2 240,144 3/17/2016
4.1.1 21,569 3/11/2016
4.1.0 4,583 3/10/2016
4.0.0 60,535 2/18/2016
3.0.0 50,107 1/11/2016
2.2.7 22,256 1/1/2016
2.2.6 4,946 12/30/2015
2.2.5 11,636 12/28/2015
2.2.4 34,926 12/3/2015
2.2.3 123,895 8/9/2015
2.2.2 47,002 6/2/2015
2.2.1 41,361 2/15/2015
2.2.0 19,215 1/25/2015
2.1.0 21,242 11/28/2014
2.0.0 19,904 3/13/2014
1.1.0 6,157 6/16/2013
1.0.0 5,177 5/5/2013
Show less