Delivery Guarantees
Open Outbox is designed to solve the “Dual Write” problem. It ensures that your database state and your message broker state eventually converge.
At-Least-Once Delivery
Section titled “At-Least-Once Delivery”The Relay guarantees that every event recorded in the outbox table will be delivered to the broker at least once.
How it works
Section titled “How it works”- Atomic Commit: Your application saves the business data and the outbox event in the same database transaction.
- Persistence: The Relay polls the database and only marks the event as delivered after it receives a successful acknowledgment (ACK) from the broker (Kafka/NATS).
- Retries: If the broker is down or the Relay crashes mid-flight, the event remains in the database and will be picked up again.
Reliability vs. Speed
Section titled “Reliability vs. Speed”The level of guarantee depends on your configuration for the specific broker for example in Kafka:
- Strict (Safe):
KAFKA_ASYNC=falseandKAFKA_REQUIRED_ACKS=all. The Relay waits for the broker to fully commit before moving on. - Relaxed (Fast):
KAFKA_ASYNC=true. The Relay assumes success once the message hits its internal buffer. Note: This can lead to data loss if the Relay crashes.