Travix-International / Hystrix.Dotnet

A combination of circuit breaker and timeout. The .net version of the open source Hystrix library built by Netflix.

Home Page:https://travix-international.github.io/Hystrix.Dotnet/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hystrix.Dotnet

A combination of circuit breaker and timeout. The .NET version of the open source Hystrix library built by Netflix.

Build Status .NET Version Coverage Status License

Why?

In order to isolate failure in one dependency from taking down another component. Whenever the circuit breaker opens it returns an exception or runs the fallback without burdening the failing system. It sends through a single request on a regular interval to see if the dependent system is back in business.

How to use

Circuit breakers are the main concept in Hystrix, and they are identifyable by a group and command key, which are arbitrary strings to support structuring and organizing the various circuit breakers we have in our application. Every circuit breaker can have its own configuration regarding its timeout, fallback mechanism, error threshold, etc.

Once we have a reference to a circuit breaker (represented by the IHystrixCommand interface), we can execute an operation through it using either the synchronous version:

T result = hystrixCommand.Execute<T>(() => myFunctionWithReturnTypeT());

Or use the async version:

T result = await hystrixCommand.ExecuteAsync<T>(() => myAsyncFunctionWithReturnTypeTaskT());

In the documentation you can find more examples, and details about creating commands and customizing the configuration.

Sample projects

In the samples directory you can find an example project illustrating the configuration of Hystrix for ASP.NET and ASP.NET Core.

Known issues

Unlike the original Hystrix implementation, the current .Net implementation doesn't use a way to limit the maximum number of concurrent requests per command. Using the ExecuteAsync method will make efficient use of the threadpool, so it's not entirely clear whether it will give us any benefits.

Neither are retries implemented at this moment.

About

A combination of circuit breaker and timeout. The .net version of the open source Hystrix library built by Netflix.

https://travix-international.github.io/Hystrix.Dotnet/

License:MIT License


Languages

Language:C# 99.4%Language:Shell 0.6%