advanced
Implement a Stateful Circuit Breaker
Implement a Circuit Breaker pattern with state management for handling downstream service failures.
📝 Contenu du Prompt
You are a Cloud Infrastructure Engineer. Write a detailed specification and code structure for a robust Circuit Breaker component. The implementation must manage states (Closed, Open, Half-Open), handle timeouts and failure thresholds, and support a sliding window or rolling counter for success/failure rates. Explain how this component integrates with a service client to prevent cascading failures in a distributed system.