Backend & systems·Queues, streams and delivery semantics
you write the row and the event to publish into the same database transaction, so you can never commit one without the other.
Transactional outbox
Also calledoutbox pattern
Persisting outbound messages in a table within the same transaction as the state change, then having a separate process publish them. It closes the dual-write gap where a commit succeeds and the broker publish fails, or vice versa. The publisher is at-least-once by nature, so consumers still need to deduplicate.