-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback Policy with dynamic result #292
Comments
@udlose . Do you have (iiuc) that HTTP header information in hand in the code before you execute through the policy? If so, you can achieve what I think you are after by using a All the
If that doesn't cover it (I've had to make some assumptions), please do elaborate and we can help further! Thanks |
Thank you for your reply! You understood correctly. I do have the information available and will take a look at using the |
@reisenberger - so I looked at using the On a different note, it would be great if the construction of the
|
Hi. Which version of Polly are you using? The ability to use context in the fallback delegates was added in v5.3.0. |
5.3.1 |
Hi @udlose ! What you're after is covered by Fallback configuration overloads which take a The principle is shown in the second example here or here. I've just seen the edit here. Great q. The Func isn't executed unless needed (see this test for confirmation), so this meets:
A specific async-TResult overload taking Using this, you can re-express the policy configuration you quoted as, eg:
EDIT: This earlier comment shows the ExecuteAsync(...) overloads to use to pass in context; also examples in the blog post. Let us know if that gives you what you need, or if you need anything else! |
Thank you. That seems to work! |
I was wondering if you have any direction on adding request-based data to a Fallback policy for an API. I have to add some info from the HTTP Headers (specific to each request) to the "default" value returned from the Fallback Policy covering that API. TIA.
The text was updated successfully, but these errors were encountered: