Real World Example

The Product Page at Scale (Amazon / Flipkart Style)

A large e-commerce product page is built from dozens of services. Several patterns from this module work together:

Page sectionSourcePattern
Title, price, imagescatalog-serviceAPI composition in the BFF (essential, short timeout)
Delivery date for your pincodelogistics-serviceComposition with fallback ("Check delivery date")
Ratings summary, top reviewsreview read modelCQRS: precomputed averages, not COUNT(*) on every view
Search results and filtersElasticsearchCQRS read model fed by product events
"Customers also bought"recommendation-serviceOptional section, loaded async, hidden on failure
Old seller dashboardlegacy monolithStrangler fig: migrated route by route

The Web BFF Endpoint

@GetMapping("/web/products/{id}")
public ProductPage productPage(@PathVariable long id, @RequestParam String pincode) {
    // essential: fail the page if this fails
    ProductDto product = catalog.get(id);

    // optional sections: each has its own timeout and fallback
    var delivery = optional(() -> logistics.estimate(id, pincode), DeliveryEstimate.unknown(), 300);
    var reviews = optional(() -> reviewView.summary(id), ReviewSummary.empty(), 200);
    var alsoBought = optional(() -> recommendations.alsoBought(id, 8), List.<ProductCard>of(), 250);

    return new ProductPage(product, delivery.join(), reviews.join(), alsoBought.join());
}

private <T> CompletableFuture<T> optional(Supplier<T> call, T fallback, long timeoutMs) {
    return CompletableFuture.supplyAsync(call, virtualThreads)
            .completeOnTimeout(fallback, timeoutMs, TimeUnit.MILLISECONDS)
            .exceptionally(ex -> {
                log.warn("Optional section failed: {}", ex.toString());
                return fallback;
            });
}

Note: The page loads in the time of the slowest essential call plus a small budget for optional ones. A broken recommendation engine never takes the "Buy Now" button down with it.