spring-boot-resilience4j

Configure Resilience4j circuit breaker, retry, rate limiter, bulkhead, and time limiter in Spring Boot.

2|Updated Jan 5, 2024
One-click install
npx skills add https://github.com/wilfriedago/dotfiles --skill spring-boot-resilience4j-wilfriedago
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spring-boot-resilience4j
Source: https://github.com/wilfriedago/dotfiles/tree/main/agents/skills/spring-boot-resilience4j
Command: npx skills add https://github.com/wilfriedago/dotfiles --skill spring-boot-resilience4j-wilfriedago

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers implement fault tolerance and resilience patterns in Spring Boot applications, preventing cascading failures and improving application stability.

Core Features & Use Cases

  • Circuit Breaker: Prevents repeated calls to failing services.
  • Retry: Automatically retries transient failures.
  • Rate Limiter: Protects services from overload.
  • Bulkhead: Isolates resources to prevent failures from spreading.
  • Time Limiter: Enforces timeouts on operations.
  • Use Case: In a microservices architecture, use this Skill to add a circuit breaker to calls to a payment gateway. If the gateway becomes unresponsive, the circuit breaker will open, and calls will be immediately rejected or handled by a fallback, preventing the entire system from crashing.

Quick Start

Apply the @CircuitBreaker annotation to a method that calls an external service, specifying a fallback method.

Frequently Asked Questions about spring-boot-resilience4j

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a circuit breaker in Spring Boot to prevent cascading microservices failures?

Implement a circuit breaker in Spring Boot using the Resilience4j library to stop repeated calls to failing services. Apply the @CircuitBreaker annotation to external service methods, specifying a fallback method to handle failures and prevent system crashes.

How do I configure retry and rate limiting for external API calls in Spring Boot?

Configure retry and rate limiting in Spring Boot using Resilience4j mechanisms. Integrate the AOP and Actuator starters to automatically retry transient failures and protect external API endpoints from overload.

What fault tolerance patterns are available for microservices communication in Spring Boot?

Fault tolerance patterns available for Spring Boot microservices include Circuit Breaker, Retry, Rate Limiter, Bulkhead, and Time Limiter. These Resilience4j mechanisms isolate resources, enforce timeouts, and prevent cascading failures during unreliable external API communication.

Does Resilience4j require Spring Boot Actuator and AOP starters for fault tolerance configuration?

Yes, Resilience4j requires integration with Spring Boot starters for AOP and Actuator to properly configure fault tolerance mechanisms. These starters enable annotation-based processing and monitoring for circuit breaker, bulkhead, and time limiter components.

How do I add a fallback method when a payment gateway becomes unresponsive in a microservices architecture?

Add a fallback method by applying the @CircuitBreaker annotation to your payment gateway call. If the gateway becomes unresponsive, the circuit breaker opens, immediately rejecting calls and routing execution to the specified fallback method to maintain stability.

When should I use a bulkhead pattern for microservices stability under load?

Use the Resilience4j bulkhead pattern when you need to isolate resources and prevent failures from spreading across microservices. It restricts concurrent executions to maintain system stability under heavy load or when external dependencies fail.