Code RoomTransactional outbox pattern
MediumPrep Room Coding #3548

Transactional outbox pattern

System designDatabases & SQLMid–Senior~35 min

An order service writes to its own Postgres and must also reliably publish an 'order changed' event to Kafka so the analytics pipeline and a downstream fulfillment service stay in sync. Today it does a dual write — commit the DB row, then publish to Kafka — and under crashes/timeouts the two diverge: orders exist with no event (lost downstream) or events fire for transactions that rolled back (phantom orders downstream). Design a reliable, ordered publish that survives crashes, with at-least-once delivery and a path to no duplicates downstream.

What a strong answer looks like

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.

Clarify4:00 left
Estimate4:00 planned
Design11:30 planned
Deep dive9:30 planned
Failure6:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.