Said Olano buys 2 blue t-shirts and one pair of Levi's 502 jeans. Five services hand the sale over through five Kafka topics until delivery is scheduled. Total charged: $812.00.
Solid arrows: calls or published messages. Dashed: replies or returns. Green: success. Red: rejections and errors. Dashed amber boxes: alternative branches; dashed blue boxes: optional steps or loops.
What to notice
No service calls another directly: each one only publishes to Kafka and listens to its topic with its own groupId.
Inventory checks every line before decrementing stock; it publishes inventory.reserved only if all of them fit.
Order computes the subtotal; Payment recomputes the subtotal per line and applies CalculadoraIva (16%, HALF_UP rounding).
MonitorFlujo uses a CountDownLatch: main waits up to 60 s for delivery.scheduled and then closes the context.
payment.processed has two independent consumers: EntregaService now and Spark later (scenario C).