🛡️ Resilience4j Lab

Watch a circuit breaker trip: calls fail, the failure rate crosses the threshold, the breaker OPENs and fails fast, then HALF-OPENs to test recovery before CLOSing again. Plus retry with exponential backoff. The two patterns that keep a service alive when its dependencies aren't.

★ Star on GitHub
CLOSED
calls pass through
OPEN
fail fast, no calls
HALF_OPEN
trial calls
sliding window (last 10):
failure rate: 0%
Try this: flip downstream is failing on and click call a few times. Once the failure rate in the sliding window hits 50%, the breaker trips to OPEN — now calls fail instantly (no waiting on a dead service) for 5s. After that it goes HALF_OPEN and lets a few trial calls through: turn failing off first and they succeed → CLOSED; leave it on and one failure kicks it straight back to OPEN.
maxAttempts=4 · backoff: 500ms → 1s → 2s (exponential ×2) · retryOnException
Try this: set fails before success and fire the call. Retry re-invokes the method with exponentially growing waits between attempts — 500ms, 1s, 2s — so a brief downstream blip is absorbed transparently. Set fails ≥ maxAttempts and every attempt is exhausted → the exception finally propagates.