Transactional outbox.
also: outbox pattern · outbox table · outbox · transactional outbox patternWriting the business change and its event to an outbox table in the same database transaction, then publishing the outbox to the broker.
the two-minute refresher
- One local transaction: UPDATE orders + INSERT INTO outbox. Both commit or neither does.
- A separate relay publishes outbox rows to Kafka: by polling, or by CDC on the log.
- The relay can publish twice (crash after send, before marking): delivery is at-least-once.
- Consumers deduplicate by event ID; clean up published rows so the table stays small.