Skip to main content

Transactional Outbox Microservice Pattern

Recommendation
Updated
Moved
USE
2023-02-23

What is it

Consider the example where a service needs to update the database and send a message with an updated event to a message broker. If the message is sent at the same time as the database call is made, there’s no guarantee that the transaction will commit. Similarly, if a service sends a message after committing the transaction there’s no guarantee that it won’t crash before sending the message. This microservices pattern addresses these issues, while also ensuring that the order of the events in the service is being sent to the message broker in the same order.

When to use it

For example, when sending changed events data from internal operational systems to analytical databases, we send messages with the changed events through messaging services (Pub/Sub) to the analytical database (BigQuery). In order to ensure consistency in this implementation we use the transactional outbox pattern.

How to learn it

Read more about the transactional outbox pattern