ColinChang.Hystrix 1.0.4

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.

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.

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

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

Release Notes

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

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.4 89 5/6/2019
1.0.3 124 4/9/2019
1.0.2 106 4/9/2019
1.0.1 104 3/27/2019
1.0.0 90 3/27/2019