Advanced System Design Fundamentals
Vote

0% completed

​

The Transactional Outbox

1. The Dual Write

A service handles a request, changes its own state, and tells the rest of the world. Written directly, that is two operations against two systems.

order = db.insert(order) # system one broker.publish(OrderCreated(...)) # system two

There is no transaction spanning both, so there are four outcomes and two of them are wrong.

  • Both succeed. Correct.
  • Both fail. Correct, nothing happened.
  • The database commits and the publish fails. The order exists and nobody downstream knows. No warehouse pick, no confirmation email, no analytics row.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content