savariamir / Finity

Finity is a .NET Core resilience and Fault tolerance library that allows developers to extend IHttpClientFactory such as Retry, Circuit Breaker, Caching, Authentication and, Bulkhead Isolation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.NET 5 CI

Fault tolerance library designed for .Net core

Finity is a .NET Core resilience and Fault tolerance library that allows developers to extend IHttpClientFactory such as Retry, Circuit Breaker, Caching, Authentication and, Bulkhead Isolation.

Finity is a lightweight fault tolerance library designed to isolate access to remote resources and services. In a distributed environment, calls to remote resources and services can fail due to transient faults, such as slow network connections, timeouts, or the resources being overcommitted or temporarily unavailable.

Using Finity with HttpClient factory from ASPNET Core

Finity extends .Net Core HttpClient Factory to avoid transienting faults.

Installing via NuGet

Install-Package Finity

Retry

services
    .AddHttpClient("finity")
    .WithRetry(options =>
    {
        options.SleepDurationRetry = TimeSpan.FromMilliseconds(100);
        options.RetryCount = 3;
    });

Circuit Breaker

services
    .AddHttpClient("finity")
    .WithCircuitBreaker(options =>
    {
        options.SuccessAllowedBeforeClosing = 1;
        options.DurationOfBreak = TimeSpan.FromMilliseconds(100);
        options.ExceptionsAllowedBeforeBreaking = 2;
    });

Caching

services
    .AddHttpClient("finity")
    .WithCache(options =>
    {
        options.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(1);
    });

Bulkhead

services
    .AddHttpClient("finity")
    .WithBulkhead(options =>
    {
        options.MaxConcurrentCalls = 100;
    });

About

Finity is a .NET Core resilience and Fault tolerance library that allows developers to extend IHttpClientFactory such as Retry, Circuit Breaker, Caching, Authentication and, Bulkhead Isolation.


Languages

Language:C# 100.0%