-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Dynamic reconfiguration during running
ℹ️ This documentation describes the previous Polly v7 API. If you are using the new v8 API, please refer to pollydocs.org.
A typical pattern with Polly is to configure policies once at startup, then apply those policies around the application where needed.
PolicyRegistry
commonly enables this scenario. Policies can be configured centrally, once, at startup, and placed into an instance of PolicyRegistry
. That instance of PolicyRegistry
can then supplied to call sites by dependency injection.
A natural extension of this pattern is to use a PolicyRegistry
for dynamic reconfiguration during running.
In some applications, it can be useful to have the ability to reconfigure policies dynamically without the disturbance of restarting the process to pick up new configuration. For example, you may want to tweak circuit-breaking thresholds to be more or less sensitive according to conditions in production.
Polly policies however were intentionally designed so that a policy's configuration is immutable: this avoids pitfalls which could arise with mutable configuration such as how to update the configuration atomically; and what the effect might be or should be on operations that are mid-running when configuration is updated.
Using PolicyRegistry
enables dynamic reconfiguration in that you can simply replace the policy in the registry with a new one, when the underlying configuration source is detected to have changed. Next time the call site pulls the policy from the registry, it will pull the newly configured version.
This works particularly well with configuration sources which can notify when the underlying configuration source has changed. This can be by raising an event, providing an Observable
, or via an Http endpoint which is called when changes occur.
- Home
- Polly RoadMap
- Contributing
- Transient fault handling and proactive resilience engineering
- Supported targets
- Retry
- Circuit Breaker
- Advanced Circuit Breaker
- Timeout
- Bulkhead
- Cache
- Rate-Limit
- Fallback
- PolicyWrap
- NoOp
- PolicyRegistry
- Polly and HttpClientFactory
- Asynchronous action execution
- Handling InnerExceptions and AggregateExceptions
- Statefulness of policies
- Keys and Context Data
- Non generic and generic policies
- Polly and interfaces
- Some policy patterns
- Debugging with Polly in Visual Studio
- Unit-testing with Polly
- Polly concept and architecture
- Polly v6 breaking changes
- Polly v7 breaking changes
- DISCUSSION PROPOSAL- Polly eventing and metrics architecture