Distributed

Lesson 03.3

Transactional outbox

The transactional outbox saves an outgoing event in the same database transaction as the data it describes, and a separate relay publishes it, so the two can never disagree.

Saved, but never told

When a cookie order comes in, Ava does two things: she saves the order on the computer, then she sends a message to the kitchen so they start baking.

Two separate steps. What if something goes wrong in between?

In this lesson you'll

  1. 1Explain why saving and then sending can leave the two out of step, and how saving the message with the order fixes it
  2. 2Watch a normal order.
  3. 3Guess what happens when Ava's tablet dies between the two steps.
  4. 4Find a rule so the kitchen always hears.