Multi-System Synchronization 00:00:01 The order exists, but the warehouse never hears Orders commits a sale and then tries to notify stock. Crash between those operations and the two systems disagree. Reversing the writes merely reverses which system can be wrong after failure. The order is inserted and committed. A deployment, a crash or a timeout happens before the publish. The database has the order. Stock never hears of it. There is no error to look at. Publishing first is no cure: the commit may fail, and stock reserves for an order that does not exist. Write down each durable point before drawing a single “synchronize” arrow. The first unsolved gap is where the business fact exists but the promise to publish it does not. 00:00:42 Put the announcement in the same envelope The order and an outgoing event row share one local commit. A relay can then find the event after the original process disappears. The outbox records the obligation independently of the caller. The order service opens a transaction. The event is inserted into the outbox in the same transaction. A worker polls the outbox, or a tool such as Debezium reads the transaction log. Stock receives the event and commits its effect with the event id. Retain the event identifier, owner and version. The relay still crosses a network boundary, so the destination must expect duplication even though the original order and outbox row were atomic. 00:01:23 The messenger delivers, then loses the receipt Marking sent before sending can lose an event. Marking sent afterward can repeat it after a crash. Follow both timelines and identify which failure an idempotent consumer can safely handle. The wrong relay marks the row as sent. It stops before publishing. After the restart the row looks done. The event is lost. After the restart the row is still unsent, so the event goes out twice. The inbox already has e1. Nothing happens the second time. The recoverable choice is to tolerate delivery again and suppress its repeated effect. Never silently discard an obligation simply because a worker once started attempting it. 00:02:04 Keep the arrival mark and stock change together A warehouse receives an order event. A unique event identifier identifies a repeat only when recording that identifier and applying the reservation use the same atomic boundary. Event e1 is not in the inbox. Insert it and reserve 2, in one commit. e1 comes again. The insert finds the key, so nothing else happens. For e2 the process stops inside the transaction. Inbox row and effect both disappear. It was not acknowledged, so e2 returns and is applied now. A crash before commit leaves both absent and a retry can proceed. A crash after commit leaves both present, so a duplicate notification cannot reserve stock for the same event twice. 00:02:47 Reconcile the shelves after the storm A search copy has fewer records than its source. Counts reveal a discrepancy, while per-range checksums narrow the search to the actual keys and values. Ordinary replication lag can look like damage. Orders has 1,000 rows and the index 999. Counting is cheap. Checksums per range lead to row 7, which is missing, and row 9, which differs. Row 9 changed 5 seconds ago. Its event is probably on the way. Row 7 is old. It is written from the source of truth, and the repair is counted. Wait beyond the expected convergence window and repair from the authority with a version check. Monitor the count and age of discrepancies so repair becomes a controlled system behavior.