Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
This isn't urgent, but it would be great if we could somehow customize Polly policies used for some reroutes. As examples, I'd like to be able to add a retry policy or change the callback used when the circuit breaker opens.
It would be easy to add my own policies in a
Perhaps there's a way we could inject Policy via DI to override the defaults?
Maybe we want ReRoute specific delegating handlers, do you agree? I had this functionality requested before.
So we need some way of mapping ReRoutes to handlers, the easiest way to do this would be to have an array of delegating handlers on the ReRoute in configuration.json.
Maybe on the ReRoute we have
"Handlers": [ "Tracer", "PollyOne" ]
then in Ocelot
services.AddOcelot() .AddDelegatingHandler<PollyOne>() .AddDelegatingHandler<Tracer>() .AddDelegatingHandler<Foo>();
When the http client is built for the ReRoute we pick out the delegating handlers that matched the string in json.
Seems simple enough!
Yea, that would do the trick. In this model, I could put whatever custom Polly policies I want in a delegating handler and then use it with particular reroutes. A couple concerns, though -