Question 1
Q1A financial services application running on Open Liberty needs to consume a RESTful API from a partner. This partner API is known for intermittent latency spikes. To prevent cascading failures, the development team wants to implement a resilience pattern that stops calling the service for a short period after a certain number of consecutive failures. Which MicroProfile Fault Tolerance annotation is the most appropriate for this specific requirement?
Show answer & explanation
Correct answer: C
The @CircuitBreaker annotation is designed specifically for this use case. It follows the circuit breaker pattern, where after a configured number of consecutive failures (requestVolumeThreshold), the circuit 'opens' and subsequent calls fail immediately without attempting to contact the failing service. After a delay (delay), it enters a 'half-open' state to test if the service has recovered. @Retry would repeatedly call the failing service, potentially worsening the problem. @Timeout only limits the duration of a single call, it does not prevent future calls. @Fallback provides an alternative execution path on failure but does not stop calls to the original service.