Circuit Breaker & Resilience with Resilience4j

    Question 1CIRCUIT BREAKEER - Purpose of Circuit Breaker

    What is the main goal of using a Circuit Breaker in a microservice?

    Question 2CIRCUIT BREAKEER - States of Circuit Breaker

    Which is not a valid state of Resilience4j Circuit Breaker?

    Question 3CIRCUIT BREAKEER - Code Snippet (Annotation Usage)

    What does this method do?

    @CircuitBreaker(name = "orderService", fallbackMethod = "orderFallback") public String placeOrder() { return restTemplate.getForObject("http://payment-service/pay", String.class); }

    Question 4RESILIENCE - Fallback Method Rule

    In Resilience4j, what must be true for a fallback method?

    Question 5CIRCUIT BREAKEER - Code Snippet (Config in application.yml)

    What does the following config do?

    resilience4j.circuitbreaker: instances: orderService: failureRateThreshold: 50 waitDurationInOpenState: 10s

    Question 6RESILIENCE - Retry Mechanism

    In Resilience4j, what does the `@Retry` annotation do?

    Question 7CIRCUIT BREAKEER - Code Snippet (Retry Example)

    What is the effect of this snippet?

    @Retry(name = "paymentRetry", fallbackMethod = "paymentFallback") public String processPayment() { return paymentClient.pay(); }

    Question 8RESILIENCE - Bulkhead Pattern

    What does the Bulkhead feature in Resilience4j achieve?

    Question 9CIRCUIT BREAKEER - Time Limiter

    What does the TimeLimiter module in Resilience4j do?

    Question 10RESILIENCE - Code Snippet (Chained Resilience Features)

    What does this configuration achieve?

    @CircuitBreaker(name = "inventoryService", fallbackMethod = "inventoryFallback") @Retry(name = "inventoryRetry") @TimeLimiter(name = "inventoryTimeout") public CompletableFuture<String> checkInventory() { return CompletableFuture.supplyAsync(() -> inventoryClient.check()); }