Ocelot
Ocelot copied to clipboard
More open customization of Polly use
In certain contexts, we need to be able to fully tune the way Polly is used for timeouts and circuit-breakers, but not only that. With this in mind, I'm proposing in this PR to open up the use of AddPolly by adding :
public static IOcelotBuilder AddPolly<T>(this IOcelotBuilder builder, Dictionary<Type, Func<Exception, Error>> errorMapping)
where T : class, IPollyQoSProvider<HttpResponseMessage> =>
AddPolly<T>(builder, GetDelegatingHandler, errorMapping);
public static IOcelotBuilder AddPolly<T>(this IOcelotBuilder builder, QosDelegatingHandlerDelegate delegatingHandler)
where T : class, IPollyQoSProvider<HttpResponseMessage> =>
AddPolly<T>(builder, delegatingHandler, ErrorMapping);
public static IOcelotBuilder AddPolly<T>(this IOcelotBuilder builder)
where T : class, IPollyQoSProvider<HttpResponseMessage> =>
AddPolly<T>(builder, GetDelegatingHandler, ErrorMapping);
Thanks to this, we will be able to use our own implementations of IPollyQoSProvider<HttpResponseMessage>
, QosDelegatingHandlerDelegate
and Dictionary<Type, Func<Exception, Error>>
Nice feature! :+1:
Not delivered