distributed transaction
A single transaction that spans several separate systems and commits in all of them or none.
In more detail
It needs a coordination protocol such as two-phase commit, which is slow and not supported by every system. Most modern systems avoid them and use patterns such as the transactional outbox instead.
Example
A database and Kafka do not share one, which is why the outbox pattern exists.Related terms
- transaction — A group of database changes that succeed or fail together, so the data is never left half-updated.
- transactional outbox — Saving an event into an outbox table in the same database transaction as the business change, then having a separate worker publish it.
- dual write — Writing the same change to two separate systems, such as a database and a message broker, from application code with no shared transaction.
Taught in
- The Transactional Outbox — Apache Kafka & Event Streaming