liveBook · Manning

Fallback

As explained in Quarkus in Action

A fallback is a fault-tolerance pattern that supplies an alternate result or behavior when an operation fails.

A fallback is a fault-tolerance pattern that supplies an alternative operation when the primary operation fails. In Quarkus, MicroProfile Fault Tolerance applies it declaratively with annotations, keeping resilience logic separate from business code. section 10.5

Fallbacks are applied where failures are observed: the calling service, not necessarily the service being called. A fallback can follow retries, returning a safe result when attempts are exhausted. section 10.5.1

Car-rental availability

The Reservation service calls Inventory for available cars. It retries the availability operation up to 25 times with a one-second delay; if Inventory remains unavailable, @Fallback(fallbackMethod = "availabilityFallback") returns an empty list through availabilityFallback. 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());
}

Shows the fallback method that returns an empty collection when availability cannot be obtained. section 10.5.1

How Quarkus in Action covers it

How deep it goes
Defines the pattern and demonstrates annotation configuration, but does not discuss imperative fallback APIs or extensive operational policy design.
Examples
Uses a Reservation-to-Inventory availability call that returns an empty car list after retries fail.
What it assumes
Assumes a Quarkus service calling another service and does not establish distributed-systems fundamentals from zero.
What you can do after
Apply it via MicroProfile annotations and a named fallback method in a Quarkus service.
How it connects
Connects fallback with fault tolerance, retries, REST clients, MicroProfile Fault Tolerance, and SmallRye Fault Tolerance.

Also explained in

Compare how 15 books explain fallback →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.