Define Polly policies via attributes #1678
KirkMunroSagent
started this conversation in
General
Replies: 1 comment
-
I think it's something that's certainly do-able, but there's probably a huge amount of variation in all the possible ways someone might want to use attributes to select a policy/strategy/pipeline to use for a given bit of code to perform an operation. I doubt it would be something that would live inside Polly itself though. This sounds like something that could be implemented separately that builds on top of Polly using the registries. It would also, I would imagine, require a lot of reflection if it's using attributes, which would work against the performance focus of the Polly v8 release. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm new to Polly, but wanted to think an idea out loud, because right off the bat it doesn't seem to work the way I wish it would.
I'd like to define the policies used on APIs that I'm invoking via conventions and attributes.
For example, I have several C# client libraries that are generated from OpenApi documents. For each of those classes I wish I could define the default policies to apply to each of those endpoints using something similar to API conventions (or using an extension to API conventions), and then be able to override the default policies on specific endpoints by applying attributes that describe the policy overrides directly to those endpoint methods.
Maybe that's not how Polly was intended to work. I just wanted to put the thought out there because it describes what I immediately looked for when I started learning about what Polly can do.
Beta Was this translation helpful? Give feedback.
All reactions