Skip to content

Latest commit

 

History

History

Bet.Extensions.Resilience.Http

Bet.Extensions.Resilience.Http

GitHub license Build status NuGet Nuget feedz.io)

The second letter in the Hebrew alphabet is the ב bet/beit. Its meaning is "house". In the ancient pictographic Hebrew it was a symbol resembling a tent on a landscape.

Note: Pre-release packages are distributed via feedz.io.

Summary

This library provides with mechanism to register Http based Polly polices.

buymeacoffee

Give a Star! ⭐

If you like or are using this project to learn or start your solution, please give it a star. Thanks!

Install

    dotnet add package Bet.Extensions.Resilience.Http

Usage

    services.AddPollyPolicy<AsyncTimeoutPolicy<HttpResponseMessage>, TimeoutPolicyOptions>(HttpPolicyOptionsKeys.HttpTimeoutPolicy)
                .ConfigurePolicy(
                    sectionName: $"{sectionName}:{HttpPolicyOptionsKeys.HttpTimeoutPolicy}",
                    (policy) => PolicyShapes.CreateTimeoutAsync<TimeoutPolicyOptions, HttpResponseMessage>(policy));

    services.AddPollyPolicy<AsyncCircuitBreakerPolicy<HttpResponseMessage>, CircuitBreakerPolicyOptions>(HttpPolicyOptionsKeys.HttpCircuitBreakerPolicy)
                .ConfigurePolicy(
                    sectionName: $"{sectionName}:{HttpPolicyOptionsKeys.HttpCircuitBreakerPolicy}",
                    (policy) => policy.HttpCreateCircuitBreakerAsync());

    services.AddPollyPolicy<AsyncRetryPolicy<HttpResponseMessage>, RetryPolicyOptions>(HttpPolicyOptionsKeys.HttpRetryPolicy)
                .ConfigurePolicy(
                    sectionName: $"{sectionName}:{HttpPolicyOptionsKeys.HttpRetryPolicy}",
                    (policy) => policy.HttpCreateRetryAsync());