Polly Transient Fault handling

So I started reading about Paramore Brighter CommandProcessor, didn’t get far and started reading about the packages it uses. This called out Polly (github)  this project takes the voodoo out of writing retry handling. In the past I’ve raised comments on .NET discussions expressing my desire for this to be built directly into the BCL. That never really seemed to go anywhere.

 
really seemed to face the same dilemma and decided to roll his own. I haven’t used it yet, but from reading the markdown readme it has a beautiful fluent interface. I will definitely be using this in the future. Some usage examples:

// Retry multiple times, calling an action on each retry 
// with the current exception, retry count and context 
// provided to Execute()
Policy
    .Handle<DivideByZeroException>()
    .Retry(3, (exception, retryCount, context) =>
    {
        // do something 
    });

Just awesome.

Advertisements