# Transactional Outbox

> Ensure reliable message publishing by storing messages in the database as part of the transaction

- **Category**: Cloud
- **Subcategory**: aws
- **Canonical URL**: https://designpattern.fyi/patterns/aws_transactional_outbox/

---

## Description
The Transactional Outbox pattern ensures reliable message publishing by storing messages in the database as part of the transaction that updates business entities. A separate process then reads these stored messages and publishes them to the message broker. This guarantees that messages are published atomically with database updates.


## Use Cases
Use when you need to guarantee that database updates and message publishing happen atomically or when implementing reliable event publishing in distributed systems.





## Trade-offs


### Advantages

- Atomic database updates and message publishing

- No message loss

- Reliable event publishing

- Handles failures gracefully




### Considerations & Drawbacks

- Additional database table required

- Separate message publisher process

- Potential for message duplication







---
**Reference**: [Original Source](https://docs.aws.amazon.com/prescriptive-guidance/latest/cloud-design-patterns/transactional-outbox.html)

