-
-
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
React to a policy state change from outside #1356
Comments
@martintmk Is this something that is possible in v8? |
The Polly V8 is conceptually very similar to V7 in this regard. It's just that in V8 we also support async callbacks and we have richer arguments in these callbacks. What could help is addition of circuit breaker partitioning. We could add the following optional callback to public class CircuitBreakerStrategyOptions<TResult>
{
public Func<ResilienceContext, string>? CircuitKeyGenerator { get; set; }
} This would allow the circuity breaker strategy (policy) to pool the circuit breakers by the key and the application to customize how these circuit breakers are pooled. @vguzmanp Would this enhancement help? |
In case of V7 all If you want to have the above described functionality then you could try the following:
The problematic part here is the
The solution is complex and fragile. If possible I would try to avoid to introduce this. |
@martintmk I'm not sure that I follow you there. |
@PeterCsalaHbo Thank you for proposing this solution
Our approach was to rely on the primitives already present in Polly for the transitions to the different circuit status and their timings; and when the thresholds are reached, modify a "feature flag" that disables the system. That way the individual circuits can keep their normal flow of states, without having to force them with
Our idea was to avoid modifying the individual CB's
I agree that it sounds complex and fragile, and adding to it, our circuit breakers are also replicated in different instances (thus the need for quorum), which adds to the complexity. |
@vguzmanp Unfortunately I'm unaware of any other simpler solution :( |
This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made. |
This issue was closed because it has been inactive for 14 days since being marked as stale. |
Summary: What are you wanting to achieve?
We are trying to implement something similar to what is mentioned in #287, taking into account Polly's circuit breakers to reach a quorum on a system uptime.
Our plan was to use the existing Circuit Breakers, wrapping them in a new CB policy that we could add
OnBreak
callbacks and react accordingly. This is because we want to let the application create their own circuit breakers and pass them in.What code or approach do you have so far?
We have two parts, an application with a connection to a system, using a circuit breaker:
And a library that receives a
policy
per system, and wraps it in a new policy updating the quorumDoing this, however, the application retains the original policy, and the wrapper policy is never executed.
Is there any way of reacting to state changes in a Circuit Breaker policy, without creating a new policy wrapping it?
Or to modify the onBreak callbacks to add extra behaviour to them?
Regards
The text was updated successfully, but these errors were encountered: