Skip to content

A Spring boot application using Resilience4J for CircuitBreaker and Retry features together

Notifications You must be signed in to change notification settings

winster/circuitbreaker_retry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Circuit Breaker with Retry Configuration

Things to notice

  • MyService::backendA will be retried a maximum of 3 attempts on any exception

  • Circuit will open after a minimum number of calls which is 5

  • Circuit will stay in open state for a maximum of 15 seconds

  • Check the fallback method signatures carefully to see how RETRY and CircuitBreaker are used together.

How to test

  • Prerequisite - make MyService::backendA to throw an exception

  • curl https://localhost:8888/api [Circuit is CLOSED]

    • Confirm that MyService::backendA is called 3 times before invoking MyService::fallbackRetry
  • curl https://localhost:8888/api [Circuit is CLOSED]

    • Confirm that MyService::backendA is called 2 times before invoking MyService::fallbackCircuitBreaker
  • curl https://localhost:8888/api [Circuit is OPEN now]

    • Confirm that MyService::backendA is not called instead MyService::fallbackCircuitBreaker is directly called

Let circuit breaker return to CLOSED state after 15 seconds. If you rerun CURL requests again, you should see the expected output remains the same.

Reference Documentation

For further reference, please consider the following sections:

About

A Spring boot application using Resilience4J for CircuitBreaker and Retry features together

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages