I am referring this https://github.com/Pathoschild/FluentHttpClient#custom-retry--coordination to create a custom retry coordination and trying to use Polly here, but I am getting below error,
'PolicyBuilder< HttpResponseMessage>' does not contain a definition for 'Retry' and the best extension method overload 'RetrySyntax.Retry(PolicyBuilder, int, Action)' requires a receiver of type 'PolicyBuilder'
What wrong here?
public class PollyCoordinator : IRequestCoordinator
{
public Task<HttpResponseMessage> ExecuteAsync(IRequest request, Func<IRequest, Task<HttpResponseMessage>> dispatcher)
{
int[] retryCodes = { 408, 500, 502, 503, 504 };
return Policy
.HandleResult<HttpResponseMessage>(r => retryCodes.Contains((int)r.StatusCode))
.Retry(3, async () => await dispatcher(request));
}
}