Resilience4j

Lightweight fault tolerance library for Java 8+ and Kotlin — the modern replacement for Netflix Hystrix (deprecated). Resilience4j provides composable resilience decorators: CircuitBreaker (auto-open on failure threshold), RateLimiter (token bucket or fixed window), Retry (exponential backoff, configurable predicates), Bulkhead (concurrent call limiting), TimeLimiter (timeout), and Cache (memoization). Designed for functional composition — decorators wrap functions (Supplier, Callable, Function). Integrates with Spring Boot (spring-cloud-starter-circuitbreaker-resilience4j), Micrometer metrics, and RxJava.

Evaluated Mar 07, 2026 (0d ago) v2.x
Homepage ↗ Repo ↗ Developer Tools java kotlin resilience circuit-breaker rate-limiter retry bulkhead timeout spring-boot
⚙ Agent Friendliness
68
/ 100
Can an agent use this?
🔒 Security
94
/ 100
Is it safe for agents?
⚡ Reliability
90
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
88
Error Messages
88
Auth Simplicity
100
Rate Limits
92

🔒 Security

TLS Enforcement
98
Auth Strength
95
Scope Granularity
90
Dep. Hygiene
92
Secret Handling
92

No network exposure. Resilience patterns prevent cascade failures that could be exploited. Circuit breaker prevents resource exhaustion from malicious slow endpoints. No credentials needed.

⚡ Reliability

Uptime/SLA
90
Version Stability
88
Breaking Changes
85
Error Recovery
95
AF Security Reliability

Best When

You're building Java/Kotlin services that call external APIs or databases and need circuit breaker, retry, rate limiting, and bulkhead patterns — especially in Spring Boot where auto-configuration simplifies setup.

Avoid When

Your resilience needs are met by Spring Retry, you need distributed (cross-pod) rate limiting, or you're not in a JVM environment.

Use Cases

  • Protect agent external API calls with circuit breakers — CircuitBreaker.decorateSupplier() wraps LLM API calls; auto-opens after N failures; fallback to cached responses during open state
  • Implement exponential backoff retry for flaky agent dependencies — Retry.of(config).executeSupplier(() -> apiCall()) with IntervalFunction.ofExponentialBackoff()
  • Rate-limit outbound agent API calls to respect third-party API quotas — RateLimiter.decorateSupplier limits calls per second to OpenAI, Anthropic, or external data APIs
  • Limit concurrent agent requests to expensive operations using Bulkhead — SemaphoreBulkhead limits concurrent agent inference calls to prevent GPU/CPU saturation
  • Add timeout protection to agent long-running operations — TimeLimiter wraps CompletableFuture with configurable timeout; prevents agent hung operations from blocking thread pools

Not For

  • Non-JVM stacks — use Polly (.NET), tenacity (Python), or Tokio retry (Rust) for resilience patterns in other languages
  • Distributed rate limiting — Resilience4j's RateLimiter is JVM-local; for distributed rate limiting across pods, use Redis + bucket4j or API gateway rate limiting
  • Teams on Spring Boot already using Spring Retry — Spring Retry covers basic retry cases; Resilience4j adds circuit breaker and bulkhead; evaluate if Spring Retry is sufficient before adding Resilience4j

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Resilience library — no auth concepts. Decorates existing service calls; auth is the underlying service's responsibility.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Resilience4j is Apache 2.0 licensed. Free for all use.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Documented

Known Gotchas

  • CircuitBreaker state is JVM-local — in multi-instance deployments (Kubernetes), each pod has independent circuit state; one pod may open circuit while others are still closed; use Redis-backed Resilience4j or API gateway for cluster-wide circuit breaking
  • Retry with exponential backoff and jitter — configure IntervalFunction.ofExponentialRandomBackoff() not ofExponentialBackoff(); without jitter, all retrying agents synchronize retry storms to the same moment (thundering herd)
  • RateLimiter period vs timeout — periodInNanos is the window size; timeoutDuration is how long to wait for a permit; setting timeoutDuration=0 returns RequestNotPermitted immediately when limit exceeded; positive timeout allows waiting for next window
  • Bulkhead type matters: Semaphore vs ThreadPool — SemaphoreBulkhead limits concurrent calls in calling thread; ThreadPoolBulkhead uses separate thread pool; mixing sync and async code requires matching bulkhead type to execution model
  • Spring Boot auto-configuration requires annotations — @CircuitBreaker, @Retry annotations need spring-cloud-starter-circuitbreaker-resilience4j; manual Resilience4j without Spring uses CircuitBreaker.of() directly; both approaches configure differently
  • Fallback method signature must match decorated method — @Fallback method must have same parameters plus a Throwable as last param; signature mismatch causes runtime BeanCreationException not compile error

Alternatives

Full Evaluation Report

Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for Resilience4j.

AI-powered analysis · PDF + markdown · Delivered within 30 minutes

$99

Package Brief

Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.

Delivered within 10 minutes

$3

Score Monitoring

Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.

Continuous monitoring

$3/mo

Scores are editorial opinions as of 2026-03-07.

6470
Packages Evaluated
26150
Need Evaluation
173
Need Re-evaluation
Community Powered