Microservice Communication Patterns 00:00:01 Buy a bicycle across three counters At the bike shop, order entry, stock and payment each have a different owner. A synchronous order waits for the downstream answers it requires. Every extra dependency becomes another place the checkout can stall. The client sends the order as an HTTP request to the gateway and waits. The order service asks the stock service to reserve the items. The slowest part of the chain answers. The client has waited for every service in the chain. Assign ownership of the business result first. A caller can wait for an immediate reservation while leaving optional emailed receipts for an asynchronous path. 00:00:39 Give each department the same order announcement The shop saves an order as pending. Inventory and payment read the resulting event independently. A customer acknowledgment here can mean the request was accepted even though the bike is not yet confirmed. The order is saved as pending and the event goes to the bus. The user already has an answer. Payment gets its own copy. Here it only prepares, because the stock is not certain yet. The stock service publishes its own fact. The order service also listens, sees the facts and marks the order as confirmed. Use the UI and status API to express that intermediate state. Persist the order and event reliably so an accepted request cannot be stranded before the departments hear about it. 00:01:22 The card is declined after the bicycle is reserved A saga commits a sequence of local operations. On failure the shop must perform sensible business compensations for the steps that already succeeded. The trace runs backward through what actually happened. The order exists and the stock is reserved. The card is declined. Nothing was charged, so there is nothing to undo here. Then the one before it. The order is not deleted: it stays visible as cancelled. Shipping was never asked. The customer is told, and the stock can be sold again. Releasing an unshipped bicycle is straightforward. A delivered parcel would require a return process, not a time reversal. Make each compensation repeatable and give unresolved cases an owner. 00:02:05 The crash between saving and announcing If order creation and event publication use unrelated writes, either one can succeed alone. An outbox stores the order and its outgoing event in one local transaction, then a relay publishes separately. The order row and the outbox row are written together. The order service dies right after. The event is safe in the database. The event reaches the bus. If the relay crashes before this step it publishes event 1 again. Consumers ignore the repeat. A relay may publish twice after a lost confirmation. Store a stable event identity at the consumer and make its effect idempotent inside its own business boundary. 00:02:46 Fifty prices should not require fifty round trips The page is assembled from fifty displayed products. Sending an individual request for each price multiplies overhead and exposes checkout to a longer chain of delays. One after the other at 5 ms each: 250 ms only for prices. Ask for 50 prices in one request. The page service keeps its own copy of prices, filled by events. Fast, and it works while the price service is down, but a price can be a moment old. A batch read can reduce round trips. A local projection can survive a pricing outage but might be stale. Ask the authoritative service when a current price becomes a binding purchase commitment.