https://github.com/App-vNext/Polly
Intergrating with a HttpDelegatingHandler probably won't work because trailers are not available. Integration will probably have to happen via interceptor.
@JamesNK I made it work properly, for Unary calls, as you mentionned, but no need to use interceptors

```
Func
{
return Policy.HandleResult
.WaitAndRetryAsync(3, (input) => TimeSpan.FromSeconds(3 + input), (result, timeSpan, retryCount, context) =>
{
var grpcStatus = (StatusCode)int.Parse(result.Result.Headers.GetValues("grpc-status").FirstOrDefault());
Console.WriteLine($"Request failed with {grpcStatus}. Retry.");
});
};
services.AddGrpcClient
{
o.Address = new Uri("https://localhost:5001");
}).AddPolicyHandler(retryFunc);
It will work if no content has been written because grpc-status is in the headers. This is fine for unary methods.
A streaming method that throws an error after it has written a message has the status in trailers, and they will not be available in the delegating handler.
You are right. Thank you.
I only used unary calls.
I will provide more examples soon
@AnthonyGiretti Did you ever add Polly examples?
Hi @Snede Here it is:
https://anthonygiretti.com/2020/03/31/grpc-asp-net-core-3-1-resiliency-with-polly/
If you have any question you can write me / email me anytime
Perfect, this is the first thing that comes up when you search gRPC and Polly on Google, so this will surely help others as well!
Anthony's blog is a good example. Will skip adding one to this repo.