Resilience is a system’s ability to stay responsive when a component or dependency fails. In a distributed application, one failure can otherwise cascade through other services. Isolating services and limiting the impact of failures helps keep requests working, or at least reduces the disruption users experience. section 9.2 section 10.5
Fault-tolerance patterns protect particular operations. Quarkus provides them through the annotation-based MicroProfile Fault Tolerance API and the `quarkus-smallrye-fault-tolerance` extension. The annotations keep recovery rules separate from business logic. section 10.5
Choose a pattern according to what should happen when an operation struggles:
- Retry a failed operation a limited number of times; use a fallback operation if it still fails. section 10.5
- Use a bulkhead to limit concurrent invocations, or a circuit breaker to stop attempting an operation after repeated failures. section 10.5
- Set a timeout to abort an operation that takes too long. section 10.5
Protecting an availability request
Suppose a Reservation service calls an Inventory service to find available cars. Add the SmallRye extension to Reservation, the caller, because its request needs protection when Inventory is unavailable. Annotating the availability method with `@Retry(maxRetries = 25, delay = 1000)` allows repeated attempts one second apart. If those attempts fail, `@Fallback(fallbackMethod = "availabilityFallback")` can return an empty car list instead of propagating an exception. Retry can keep the request waiting for up to 25 seconds when Inventory is down, and the retried method must be idempotent so repeated execution does not cause inconsistent side effects. section 10.5.1
Listing 10.8 Fault tolerance availability fallback
public Uni<Collection<Car>> availabilityFallback(LocalDate startDate,
LocalDate endDate) {
return Uni.createFrom().item(List.of());
}
The fallback method returns an empty collection in the same `Uni<Collection<Car>>` shape as the availability result. section 10.5.1
These annotations address failures during an operation; they do not make a failing dependency healthy. The declarative API is the focus here, rather than SmallRye Fault Tolerance’s separate programmatic API. section 10.5 section 10.5.1












