Company
Date Published
Author
Bryan Hogan
Word count
2092
Language
English
Hacker News points
None

Summary

Polly Circuit Breakers are used to handle transient faults and longer outages in .NET Web service consumers. They can be viewed as state machines that start in a closed state, allowing the flow of requests across it, but move to an open state when a problem is detected, blocking all requests for a specified period. The circuit breaker then moves to a half-open state where the first request is treated as a test request, and if successful, the circuit closes and normal operation resumes. Polly offers two variations of the policy: basic and advanced, with the basic one cutting the connection when a specified number of consecutive failures occur, and the advanced one cutting the connection when a specified percentage of errors occur over a specified period and when a minimum number of requests have occurred in that period. The circuit breaker can be used to handle connections to multiple endpoints, sharing state while executing requests.