liveBook · Manning

Outbox event

As explained in Crack Any Codebase with AI

An outbox event is a persistent database record describing an external side effect that a worker must deliver after a transaction commits.

An outbox event is a persistent database record describing an external side effect that a worker must deliver after a transaction commits. Writing it in the same transaction as the core change closes the crash gap between COMMIT and an external API call. section 8.4

A reliable handoff follows this sequence:

  • Save the core record and its outbox_event row in one database transaction. section 8.4
  • Commit the transaction and return the API response without waiting for external side effects. section 8.4
  • Let a separate worker drain the outbox asynchronously, retrying failed deliveries when appropriate. section 8.4

Booking confirmation

A booking transaction saves the reservation and an outbox_event row for a calendar webhook. If the server crashes immediately after COMMIT, the worker can still deliver the webhook instead of silently losing it. section 8.4

How Crack Any Codebase with AI covers it

How deep it goes
Explains atomic recording, post-commit draining, crash loss, retries, and dead-letter handling without detailing schema or worker internals.
Examples
Uses bookings, calendar events, confirmation emails, Slack alerts, webhooks, and background jobs as side-effect examples.
What it assumes
Assumes database transactions, API commits, external calls, and background workers as familiar system components.
What you can do after
Diagnose/debug with it by testing whether every asynchronous task is durably written before a worker attempts delivery.
How it connects
Connects database transactions with asynchronous fan-out, worker processes, webhooks, retries, and dead-letter queues.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Crack Any Codebase with AI. The section links point to the parts of the book it draws on.