All Projects → alexandrnikitin → Circuitbreaker.net

alexandrnikitin / Circuitbreaker.net

Licence: mit
Circuit Breaker pattern for .NET

Projects that are alternatives of or similar to Circuitbreaker.net

Gossip Python
Implementation of the gossip protocol
Stars: ✭ 100 (-13.79%)
Mutual labels:  distributed-systems
Door Slam
Distributed, Online, and Outlier Resilient SLAM for Robotic Teams
Stars: ✭ 107 (-7.76%)
Mutual labels:  distributed-systems
Pegasus
Pegasus Workflow Management System - Automate, recover, and debug scientific computations.
Stars: ✭ 110 (-5.17%)
Mutual labels:  distributed-systems
Jupiter
Jupiter是一款性能非常不错的, 轻量级的分布式服务框架
Stars: ✭ 1,372 (+1082.76%)
Mutual labels:  distributed-systems
Parapet
A purely functional library to build distributed and event-driven systems
Stars: ✭ 106 (-8.62%)
Mutual labels:  distributed-systems
Micro
Micro is a distributed cloud operating system
Stars: ✭ 10,778 (+9191.38%)
Mutual labels:  distributed-systems
Library
Collection of papers in the field of distributed systems, game theory, cryptography, cryptoeconomics, zero knowledge
Stars: ✭ 100 (-13.79%)
Mutual labels:  distributed-systems
Xaynet
Xaynet represents an agnostic Federated Machine Learning framework to build privacy-preserving AI applications.
Stars: ✭ 111 (-4.31%)
Mutual labels:  distributed-systems
Pattern Matching Ts
⚡ Pattern Matching in Typescript
Stars: ✭ 107 (-7.76%)
Mutual labels:  pattern
Nginx Lua Redis Rate Measuring
A lua library to provide distributed rate measurement using nginx + redis, you can use it to do a throttling system within many nodes.
Stars: ✭ 109 (-6.03%)
Mutual labels:  distributed-systems
Adaptdl
Resource-adaptive cluster scheduler for deep learning training.
Stars: ✭ 100 (-13.79%)
Mutual labels:  distributed-systems
Hermes
Hermes: a fault-tolerant replication protocol, implemented over RDMA, guaranteeing linearizability and achieving low latency and high throughput.
Stars: ✭ 105 (-9.48%)
Mutual labels:  distributed-systems
Etcd
Distributed reliable key-value store for the most critical data of a distributed system
Stars: ✭ 38,238 (+32863.79%)
Mutual labels:  distributed-systems
Foundatio
Pluggable foundation blocks for building distributed apps.
Stars: ✭ 1,365 (+1076.72%)
Mutual labels:  distributed-systems
Rd Blender Docker
A collection of Docker containers for running Blender headless or distributed ✨
Stars: ✭ 111 (-4.31%)
Mutual labels:  distributed-systems
Short Url
简单的分布式短链接服务实现
Stars: ✭ 100 (-13.79%)
Mutual labels:  distributed-systems
Awesome Distributed Systems
Awesome list of distributed systems resources
Stars: ✭ 1,466 (+1163.79%)
Mutual labels:  distributed-systems
Gerstnerizer
💠 pattern generator based on the idea of the book "Forms of Colors"
Stars: ✭ 114 (-1.72%)
Mutual labels:  pattern
Genie
Distributed Big Data Orchestration Service
Stars: ✭ 1,544 (+1231.03%)
Mutual labels:  distributed-systems
Dotnet Istanbul Microservices Demo
This is the demo application that i created for my talk 'Microservice Architecture & Implementation with Asp.Net Core' at Dotnet İstanbul Meetup Group.
Stars: ✭ 109 (-6.03%)
Mutual labels:  distributed-systems

CircuitBreaker.Net

Build Status NuGet version

Overview

CircuitBreaker.Net is an implementation of the Circuit Breaker pattern for .NET. This pattern can improve the stability and resiliency of your application, especially in SOAP, microservices and distributed environments. The pattern serves two main purposes: to isolate communication with third-party services, so that your application won't be affected by their fails. And to react to third-party services' fails: it could be a pause, throttling, fail-over, default behavior, etc.
You can read about the pattern on MSDN or from Martin Fowler.

Install

It's available via a nuget package
PM> Install-Package CircuitBreaker.Net

Example Usage

// Initialize the circuit breaker
var circuitBreaker = new CircuitBreaker(
    TaskScheduler.Default,
    maxFailures: 3,
    invocationTimeout: TimeSpan.FromMilliseconds(100),
    circuitResetTimeout: TimeSpan.FromMilliseconds(10000));

try
{
    // perform a potentially fragile call through the circuit breaker
    circuitBreaker.Execute(externalService.Call);
    // or its async version
    // await circuitBreaker.ExecuteAsync(externalService.CallAsync);
}
catch (CircuitBreakerOpenException)
{
    // the service is unavailable, failover here
}
catch (CircuitBreakerTimeoutException)
{
    // handle timeouts
}
catch (Exception)
{
    // handle other unexpected exceptions
}

Why?

There are not so many of them. I didn't find any that would suit me. Polly seems the most mature from all of them but it has a locking nature and it doesn't provide a way to specify a separate TaskScheduler to execute actions. But that's a crucial aspect when you call a third-party service, because those calls could stuff your "main" TaskScheduler. Actually none of those libraries support injection of a TaskScheduler. Helpful.CircuitBreaker by RokitSalad isn't thread safe. CircuitBreaker by kylos101 executes actions on the same thread. ManagedCircuitBreaker by AsherW is a fork of Polly with emphasize on IoC containers. The code provided on MSDN isn't production ready and just a piece of code. And so on so forth. So that the yet another library was born. I hope you will find it helpful. 😉

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].