Transactional outbox: publishing order events

Save each event in the same transaction as the order, and let a relay publish it to the broker.

Level Advanced

What you will see

  1. Saved, but never announced
  2. Two writes, one can fail
  3. The order and its event, in one transaction
  4. The relay publishes, then marks
  5. Consumers that tolerate duplicates
  6. When a lost message is acceptable

Before / after

Base: naive-crud-goView the diff

Exercises