Is it possible to share CircuitBreaker state across several pipelines? #2264
-
I have a few different pipelines with slightly different configurations. As an example, one might be for idempotent operations that can retry and a separate one for operations that should not retry. There might also be different settings for timeouts. However, they all access the same underlying resource and I want to use a common circuit breaker so I applied the same CircuitBreakerStrategyOptions instance to all the pipelines. However, it seems that each pipeline has its own circuit breaker CircuitStateController so when one breaks the others are still active. Is there a way to share circuit breaker states across multiple pipelines? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
If you take a look at our documentation for pipeline registries you should be able to see how you can build up a pipeline composed of references to shared strategies. |
Beta Was this translation helpful? Give feedback.
I figured out a way that is working in all my tests. Hopefully I didn't miss something crucial!
First I have to create a ResiliencePipeline that just holds the desired circuit breaker strategy:
Then I can add that to any pipeline that needs that same state using the AddPipeline() builder extension method: