Skip to content

NRetry Framework, an abstraction layer for retriable operations

License

Notifications You must be signed in to change notification settings

Murilo-Perrone/NRetry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Synopsis

NRetry Framework, an abstraction layer for retryable operations, is meant to simplify and standardize the requests to operations which may need, if they fail, to be re-attempted a number of times. By allowing NRetry to take care of the looping, failure detection, optional recovery action and optional exception handling, your calling code is greatly simplified. You can even call your retrieble operation asynchronously.

Code Example

In the most trivial example below, :

var retryer = new TaskRetryer {
  RetryableOperation = MyOperation,
  ExceptionLogger = (args) =>
    Console.WriteLine("Exception:\n" + args.Exception),
};

// Maximum of 3 attempts and one minute wait between attempts
retryer.Config.MaximumAttempts = 3;
retryer.Config.RetryInterval = 60*1000;

// Trying out attempts. The last attempt may throw an exception, as it won't be wrapped with a try-catch.
bool success = retryer.ProcessRetries();

For further examples, check the Examples Page or check to the code in the unit test project.

Motivation

This project was motivated by my experience with a project following Component-based software engineering, were each component was called over a timeline. And further usage of it was found in a data-intensive project following SOA architecture, were a few different internal services were exposed in multiple redundant servers. There it is used in almost 100 different places and the framework came in handy to standardize the way other developers write calls to those services, assuring correct usage of the server redundancy in order to sustain the system's robustness.

License

The MIT License allows you to anything what you need with this code, as long as you provide attribution back to me and don't hold me liable.

About

NRetry Framework, an abstraction layer for retriable operations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages