Circuit Breaker Pattern

A resilience pattern that prevents cascading failures when a carrier API is down.

The circuit breaker has three states: 1. Closed (normal): requests flow through 2. Open (tripped): all requests fail fast without calling the carrier 3. Half-Open (testing): one request goes through to test recovery Trip the breaker after N consecutive failures. In Open state, return a cached response or queue the request. After a cooldown, enter Half-Open and test with one request. If it succeeds, close the breaker.