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

2 thoughts on “Polly Transient Fault handling

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s