Bulkhead
Keep one failing path from exhausting threads, connections, or queues needed elsewhere.
Retry is one of the simplest resilience tools and one of the easiest to misuse. Bulkheads isolate resource pools so one troubled dependency does not consume the capacity needed by others. Together, these patterns help services stay alive under failure pressure, but only when timeouts, idempotency, and retry budgets are designed carefully.
If checkout retries payment calls aggressively while sharing the same thread pool used for order confirmation and inventory lookups, one slow downstream can freeze the whole user journey. Bulkheads and measured retries stop local overload from becoming platform-wide damage.
Bulkheads isolate concurrency and resource pools so failures stay contained. Retry allows another attempt when failure is transient, but each retry is also extra load. The safe combination requires small retry budgets, backoff, jitter, and confidence that the operation is idempotent or otherwise safe to repeat.
Think of retry as a precision tool, not a reflex. The goal is to improve success on transient problems without overwhelming the dependency or duplicating side effects.
Keep one failing path from exhausting threads, connections, or queues needed elsewhere.
Use measured repeat attempts only when the failure is plausibly transient and the operation is safe.
Spread retry pressure over time so a recovering dependency is not hit all at once.
Know whether repeating the operation preserves the same business outcome.
Retry a few times with backoff, not forever and not immediately in a tight loop.
Keep slow downstream calls from consuming all upstream capacity.
Watch whether retries recover work or just amplify incidents.
package org.javaomnibus.payments.client;
public final class PaymentCommandClient {
private final Bulkhead bulkhead;
private final Retry retry;
private final PaymentGateway gateway;
public AuthorizationResult authorize(OrderId orderId, Money total, String idempotencyKey) {
return bulkhead.execute(() ->
retry.execute(() -> gateway.authorize(orderId, total, idempotencyKey))
);
}
}