Question
Design the order-events ingestion pipeline for a food-delivery marketplace processing ~40k order state-change events/sec at peak (order placed, accepted, picked up, delivered, cancelled). Downstream consumers include real-time courier dispatch (sub-second), a fraud model, and a financial ledger that must be exactly-once and reconcilable to the cent. Producers are mobile apps on flaky networks that retry aggressively, so the same event arrives 2–5x. Design the ingestion, dedup, ordering-per-order, and delivery guarantees so dispatch stays fast while the ledger stays exact.
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.