liveBook · Manning

Outbox table

As explained in Grokking Software Architecture

An outbox table is a database table that stores messages or events for later delivery by a separate process.

An outbox table is a local database table that holds messages or events for a separate background process to deliver. It helps avoid the risky gap between saving business data and sending a network message. section 12.5.2 section 12.6.1

Write the business data and its event to the outbox in the same ACID transaction. A background process later forwards the message to a broker. If the transaction succeeds, both records are saved; if it fails, neither is. This provides at-least-once delivery without trying to update a database and send a network message at the same time. section 12.6.1

Inventory event

An InventoryService saves its database update and an InventoryDeducted event in the same transaction. A background process then reads the outbox and sends the event to the network, so a crash after the save does not leave the event unpublished. section 12.6.1

How Grokking Software Architecture covers it

How deep it goes
Explains the shared database transaction and background relay, but does not detail relay implementation.
Examples
Uses an InventoryService saving an InventoryDeducted event before a background process forwards it.
What it assumes
Assumes a local database transaction and a separate background process, without establishing prior knowledge.
What you can do after
Apply it to publish events reliably by saving them with business data and relaying them afterward.
How it connects
Connects transactional outbox patterns with ACID transactions, message brokers, microservices, Sagas, and dual writes.

Also explained in

Compare how 2 books explain outbox table →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.