Curriculum · Module 08, Distributed Transactions
Idempotency keys and the outbox
Retries cause duplicates, and a database write plus a publish can lose a message. Keys make requests safe to repeat, and an outbox makes the write and the event one transaction.
What each topic covers
- A client that gets no reply sends the request again. The first one may have worked, so the retry makes a duplicate.
- The client names the operation with a key. The service stores the key with the result and answers a repeat from the store.
- Take orders from retrying clients, publish an event for each, and compare a dual write with the outbox, with and without keys.
- A key table cannot grow forever. A retry that arrives after its key was forgotten looks like a new request.
- Updating a database and a broker with two calls cannot be made safe. The outbox makes it one transaction.
- The relay publishes, then marks the row. A crash between them repeats the event. The consumer must make repeats harmless.
- Three quick checks on idempotency keys, the outbox and the relay, with the sources behind the lesson.
Topics
Practise this lesson
8 interview questions on idempotency and the outbox, with worked answers and sources.
Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms