AlgoMaster Logo

Outbox Pattern

Medium Priority15 min readUpdated October 9, 2026
AI Mock Interview

Practice this topic in a realistic system design interview

Premium Video

This video is available to premium subscribers only

Unlock Full Access

Suppose we have an order service in an e-commerce application. When a customer places an order, the service saves it to a database and publishes an OrderCreated event to a message broker like Kafka.

Other services depend on that event:

  • The inventory service reserves the items.
  • The email service sends a confirmation.
  • The analytics service records the sale.

So the order service needs to perform two operations: write the order to its database and publish an event to the broker. The problem is that these are two separate systems. A normal database transaction cannot atomically commit changes to both. This is known as the dual-write problem.

The transactional outbox pattern is the standard way to solve it.

In this chapter, we will look at how the outbox pattern solves the dual-write problem, how events are reliably published to a message broker, and the important details around delivery guarantees, ordering, retries, and cleanup.

1. The Dual-Write Problem

Premium Content

This content is for premium members only.