Expand description
FR-9 — Transactional outbox: atomic event + outbox write.
Distinct from crate::outbox, which is a journal-tailing relay that
re-publishes already-committed events at-least-once on a polling loop.
This module instead writes the event row and its outbox row inside the
same sqlx::Transaction the caller controls, so the two either
commit together or roll back together — there is no window where an event
exists without its outbox entry (or vice versa).
The caller owns commit/rollback: TxOutbox::persist_with only enqueues
both INSERTs on the supplied transaction.
ⓘ
let mut tx = pool.begin().await?;
TxOutbox.persist_with(&mut tx, event_row, outbox_row).await?;
tx.commit().await?; // both rows land atomicallyStructs§
- Event
Row - The event row to append to
event_journal. A small param struct so we never need to touchatomr_persistence::PersistentRepr. - Outbox
Row - The outbox row to append to
outboxin the same transaction. - TxOutbox
- Zero-sized handle for the transactional outbox write.
Enums§
- Outbox
Error - Errors from the transactional outbox write.