Skip to content

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

License

Notifications You must be signed in to change notification settings

colin-chang/Hystrix

Repository files navigation

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.

Nuget

# Package Manager
Install-Package ColinChang.Hystrix

# .NET CLI
dotnet add package ColinChang.Hystrix

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages