Skip to content

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

License

Notifications You must be signed in to change notification settings

Travix-International/Hystrix.Dotnet

Repository files navigation

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published