Comparison
Dual writevsTransactional outbox
Dual write
you wrote to both databases for the whole migration, and spent a week chasing the rows where only one write landed.
Writing the same data to the old and new stores during a migration so either can serve reads. It is easy to describe and hard to do correctly, because two writes without a shared transaction will eventually diverge, and the divergence is silent. Teams that do it successfully plan for reconciliation from the start — a comparison job, a repair path, and a decision about which store is authoritative at each phase.
Full entry →Transactional outbox
you write the row and the event to publish into the same database transaction, so you can never commit one without the other.
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.
Full entry →