0
0
Spring Bootframework~10 mins

Circuit breaker with Resilience4j in Spring Boot - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to annotate a method with a circuit breaker using Resilience4j.

Spring Boot
@CircuitBreaker(name = "[1]")
public String callExternalService() {
    // method implementation
}
Drag options to blanks, or click blank then click option'
AexternalService
BserviceCall
CcircuitBreaker
DbackendService
Attempts:
3 left
💡 Hint
Common Mistakes
Using a generic name that does not match configuration
Leaving the name blank
Using an invalid identifier
2fill in blank
medium

Complete the code to configure the circuit breaker failure rate threshold in application.yml.

Spring Boot
resilience4j.circuitbreaker.instances.backendService.failureRateThreshold: [1]
Drag options to blanks, or click blank then click option'
A50
B100
C25
D75
Attempts:
3 left
💡 Hint
Common Mistakes
Setting failure rate threshold too high or too low
Using invalid numeric values
Forgetting to specify the correct instance name
3fill in blank
hard

Fix the error in the annotation to enable fallback method on circuit breaker failure.

Spring Boot
@CircuitBreaker(name = "backendService", fallbackMethod = "[1]")
public String callExternalService() {
    // method implementation
}
Drag options to blanks, or click blank then click option'
AhandleFallback
BfallbackHandler
CfallbackMethod
Dfallback
Attempts:
3 left
💡 Hint
Common Mistakes
Using a generic or incorrect fallback method name
Not defining the fallback method at all
Mismatch in method parameters
4fill in blank
hard

Fill both blanks to configure the wait duration and sliding window size for the circuit breaker.

Spring Boot
resilience4j.circuitbreaker.instances.backendService.waitDurationInOpenState: [1]
resilience4j.circuitbreaker.instances.backendService.slidingWindowSize: [2]
Drag options to blanks, or click blank then click option'
A30s
B60s
C100
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing units between time and count
Setting too small or too large values
Using invalid formats like missing 's' for seconds
5fill in blank
hard

Fill all three blanks to complete the method signature for a fallback method with exception parameter.

Spring Boot
public String [1](Throwable [2]) {
    return "Fallback response due to " + [3].getMessage();
}
Drag options to blanks, or click blank then click option'
AhandleFallback
Bex
Cexception
Derror
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between fallback method name and annotation
Using different parameter names inconsistently
Not including Throwable parameter