Meet Fences: The .NET resilience library

Fences logo

Fences is a powerful library for .NET that helps you handle transient faults and improve the resilience of your applications. With Fences, you can easily define and apply strategies such as Retry, Circuit Breaker, Hedging, Timeout, Rate Limiter and Fallback to handle failures and slowdowns in a fluent and thread-safe way.

Fences is a community fork of Polly, maintained by Brighter Command. It is not affiliated with, endorsed by, or supported by App vNext or the Polly maintainers. If you are coming from Polly, start with Migrate from Polly.

What can Fences do for you?

Fences lets you use and combine different resilience strategies to cope with various scenarios, such as:

  • Retry: Try again if something fails. This can be useful when the problem is temporary and might go away.
  • Circuit Breaker: Stop trying if something is broken or busy. This can benefit you by avoiding wasting time and making things worse. It can also support the system to recover.
  • Timeout: Give up if something takes too long. This can improve your performance by freeing up space and resources.
  • Rate Limiter: Limit how many requests you make or accept. This can enable you to control the load and prevent problems or penalties.
  • Fallback: Do something else if something fails. This can improve your user experience and keep the program working.
  • Hedging: Do more than one thing at the same time and take the fastest one. This can make your program faster and more responsive.

You can learn more about each strategy and how to use them resilience strategies section.

How to get started with Fences?

Fences is easy to install and use. You can follow the getting started guide to add and start using Fences in your projects.

Where to find more information?

Fences has a rich documentation that covers various topics, such as:

  • Migrate from Polly: The package, namespace and telemetry changes needed to move an existing Polly project across.
  • Resilience strategies: A collection of strategies for improving the resilience of your system.
  • Resilience pipelines: How to combine and reuse strategies in a flexible and modular way.
  • Telemetry and monitoring: How to access and analyze the data generated by Fences strategies and pipelines.
  • Dependency injection: How to integrate Fences with dependency injection frameworks and containers.
  • Performance: Tips on optimizing and getting the best performance from Fences.
  • Testing: How to test the composition and configuration of resilience pipelines.
  • Chaos engineering: How to use Fences to inject faults and test the resilience of your system.
  • Extensibility: How to create and use custom strategies and extensions for Fences.

You can also find many resources and community contributions, such as:

  • Samples: Samples in this repository that serve as an introduction to Fences.
  • Practical Samples: Practical examples written for Polly. The v8 API is unchanged in Fences, so they apply once the package references and namespaces are swapped.
  • Libraries and contributions: Dependencies and contributors that make Fences possible and awesome.
  • Git Workflow: Our suggested Git workflow for contributing to Fences.

You can browse the documentation using the sidebar or visit the API section for the reference documentation.