Bird
0
0

You want to design a Spring Boot microservice that calls an unstable external payment API. Using Resilience4j circuit breaker, which approach best ensures system stability and graceful degradation?

hard📝 Application Q15 of 15
Spring Boot - Advanced Patterns
You want to design a Spring Boot microservice that calls an unstable external payment API. Using Resilience4j circuit breaker, which approach best ensures system stability and graceful degradation?
AApply @CircuitBreaker with a fallback method returning a cached payment status
BRemove circuit breaker and rely on retries only
CUse @CircuitBreaker without fallback to fail fast
DDisable circuit breaker and increase thread pool size
Step-by-Step Solution
Solution:
  1. Step 1: Understand system stability needs

    Using a circuit breaker prevents repeated calls to the unstable API, avoiding overload.
  2. Step 2: Importance of fallback for graceful degradation

    A fallback method returning cached or default data keeps the system responsive during failures.
  3. Step 3: Evaluate other options

    Retries alone can worsen overload; no fallback causes failures; increasing threads doesn't solve API instability.
  4. Final Answer:

    Apply @CircuitBreaker with a fallback method returning a cached payment status -> Option A
  5. Quick Check:

    Circuit breaker + fallback = stability + graceful degradation [OK]
Quick Trick: Combine circuit breaker with fallback for best resilience [OK]
Common Mistakes:
  • Relying only on retries without circuit breaker
  • Not providing fallback causing failures
  • Increasing threads without handling failures

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes