ColinChang.Hystrix 1.0.4

.NET Standard 2.0
Install-Package ColinChang.Hystrix -Version 1.0.4
dotnet add package ColinChang.Hystrix --version 1.0.4
<PackageReference Include="ColinChang.Hystrix" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ColinChang.Hystrix --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ColinChang.Hystrix, 1.0.4"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ColinChang.Hystrix as a Cake Addin
#addin nuget:?package=ColinChang.Hystrix&version=1.0.4

// Install ColinChang.Hystrix as a Cake Tool
#tool nuget:?package=ColinChang.Hystrix&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Hystrix

This is a light AOP framework that allows you to use Polly to handle exceptions with some policies like circuit break or fallback and so on of your .net core application.It's like Hystrix from Java Platform.

  • Based on Polly and AspectCore.Core.
  • Used as Attribute conveniently.
  • Class must be public and method must be virtual.

Sample:

[Hystrix(nameof(RetryTestFallBackAsync), MaxRetryTimes = 3, EnableCircuitBreaker = true)]
public virtual async Task<string> RetryTestAsync(string str)//It must be virtual method
{
    Console.WriteLine(nameof(RetryTestAsync));
    str.ToString();

    return await Task.FromResult("ok" + str);
}

public async Task<string> RetryTestFallBackAsync(string name)
{
    Console.WriteLine(nameof(RetryTestFallBackAsync));

    return "RetryTestFallBackAsync";
}

We provide 2 samples to show how to use this in Console and Asp.Net Core.

Advanced

The link below explain its theory and how it works.

https://colin-chang.site/netcore/pages/microservice-polly.html

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 406 5/6/2019
1.0.3 361 4/9/2019
1.0.2 353 4/9/2019
1.0.1 360 3/27/2019
1.0.0 349 3/27/2019

change the return value of "RegisterAssemblyTypes“ for a fluent style programming