An order is saved, but the network drops before the OrderPlaced event reaches the broker. Shipping and payment never hear about it. Publishing first is no safer: if the database write fails, the event announces an order that does not exist. This fragile two-step operation is a dual write. section 7.5.1
The transactional outbox pattern replaces the network write with a local one. The service saves the business data and an outgoing event in an Outbox table in the same database transaction. Both writes commit, or neither does. A separate background process reads the table and forwards messages to the broker asynchronously. section 12.6.1
Keeping a saga moving
An inventory service records an inventory deduction and its InventoryDeducted event together. If the service crashes before publishing, the committed event remains in the outbox for the background process to forward; billing does not depend on the original request making a network call successfully. section 12.6.1
The local transaction protects the data and the record of the message—not a simultaneous database-and-broker commit. The relay provides at-least-once delivery, so consumers must be ready for repeated events. An event identifier can help an idempotent consumer recognize an event occurrence. section 12.6.1 section 7.5.1
An outbox can also support application-level synchronization during a migration when database transaction logs are inaccessible. It avoids writing directly to both the legacy and new databases across an unreliable network; change data capture is another option when log access is available. section 12.5.2



