-
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.
-
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.
For further reference, please consider the following sections: