WEBVTT

NOTE AI Engineering Visualised: https://understandingdata.com/ai-engineering-visualised/transactional-outbox/

1
00:00:00.067 --> 00:00:03.059
An order and the event announcing it belong together.

2
00:00:03.059 --> 00:00:11.202
The transactional outbox writes the order and a pending event in one database transaction, while a separate relay delivers the event later.

3
00:00:11.202 --> 00:00:13.299
First, this transaction rolls back.

4
00:00:13.299 --> 00:00:20.180
Both staged writes disappear together: no saved order, no outbox event, and nothing for the relay to publish.

5
00:00:20.180 --> 00:00:24.869
A second transaction commits, so both records become durable at the same boundary.

6
00:00:24.869 --> 00:00:27.519
The relay reads the committed event and publishes it.

7
00:00:27.519 --> 00:00:30.439
Now it crashes before marking the outbox row sent.

8
00:00:30.439 --> 00:00:37.190
The broker already holds the message, but the database still says unsent; those actions were never one atomic transaction.

9
00:00:37.259 --> 00:00:39.899
The consumer also needs an atomic boundary.

10
00:00:39.899 --> 00:00:45.979
Here a consumer transaction rolls back: neither its processed-event key nor its business effect survives.

11
00:00:45.979 --> 00:00:51.013
On retry, both commit together, so a later delivery can recognise completed work.

12
00:00:51.013 --> 00:00:54.520
After the relay restarts, the unsent row is published again.

13
00:00:54.520 --> 00:00:57.659
This second delivery carries the same event identifier.

14
00:00:57.659 --> 00:01:04.983
The consumer ledger already contains that identifier, so the duplicate adds no new effect: two deliveries, one committed effect.

15
00:01:05.040 --> 00:01:10.720
That is reliable processing through two local atomic boundaries, with duplicates allowed between them.

16
00:01:10.720 --> 00:01:20.507
The guarantee depends on a durable ledger committed with the effect, so an external charge or email needs its own idempotency strategy; transport alone is not exactly once.
