MODULE 02 // LAYER ARCHITECTURE
MODULE 06 // CIRCUIT BREAKER

Resilience Patterns.

When ABIS fails, your application shouldn't. Circuit breakers prevent cascade failures, protect system resources, and enable graceful degradation during outages.

CIRCUIT BREAKER STATES

The circuit breaker pattern prevents repeated attempts to call a failing service. It operates in three states: CLOSED (normal operation), OPEN (service unavailable, fail fast), and HALF-OPEN (testing if service recovered).

Key parameters: failure threshold (how many failures before opening), timeout duration (how long circuit stays open), success threshold (consecutive successes needed to close from half-open), and failure detection logic (what counts as a failure).

Critical for ABIS integration: circuit breakers enable fail-open behavior (allow requests when ABIS is down), prevent thundering herd (don't all retry simultaneously), and provide observability (metrics on circuit state transitions).

CLOSED

Normal Operation

Requests flow through to ABIS. Failure counter tracks errors. Opens circuit after threshold exceeded.

OPEN

Fast Failure

All requests fail immediately without calling ABIS. Protects downstream service. Automatically transitions to HALF-OPEN after timeout.

HALF-OPEN

Recovery Test

Limited requests sent to test recovery. Success closes circuit. Failure reopens circuit.

KNOWLEDGE CHECK // Q06
What's the purpose of the HALF-OPEN state in a circuit breaker, and why not go directly from OPEN to CLOSED?