Topic lessonTopic: Applied container, data, cost and AI labs
Exercise retries and idempotency|Avoid duplicate writes
A failure between committing a side effect and acknowledging a message can cause reprocessing.
Use durable business event IDs to distinguish replay from a first commit.
The cases use fictional inputs.
What to predict
A failure between committing a side effect and acknowledging a message can cause reprocessing.
- First effect committed → A delivery is repeatedAlign conditions
- A delivery is repeated → Committed ID is stored atomicallyCompare outcomes
- Committed ID is stored atomically → DecisionVerify the decision
- First effect committed
- Yes / No
- A delivery is repeated
- Yes / No
- Committed ID is stored atomically
- Yes / No
- Decision
- Use durable business event IDs to distinguish replay from a first commit.
Compare the cases
| Case | Conditions | Decision |
|---|---|---|
| Trial 1 | First effect committed Yes, A delivery is repeated Yes, Committed ID is stored atomically Yes | The repeated ID is recognized. Effective writes: 1. |
| Trial 2 | First effect committed Yes, A delivery is repeated Yes, Committed ID is stored atomically No | The earlier write cannot be identified. This gives 2 effects. |
| Trial 3 | First effect committed Yes, A delivery is repeated No, Committed ID is stored atomically Yes | No delivery is repeated. Effective writes: 1. |
| Trial 4 | First effect committed No, A delivery is repeated Yes, Committed ID is stored atomically Yes | The next handling is the first commit. Effective writes: 1. |
Acceptance and limits
Uses at most two deliveries of one synthetic ID and assumes atomic storage of result and ID. It omits real ordering, timing and concurrency.
Read the initial conditions and operational goal.
Change one condition and compare the decision.
Record the model boundary and outstanding checks.
Change a condition
Uses at most two deliveries of one synthetic ID and assumes atomic storage of result and ID. It omits real ordering, timing and concurrency.
The repeated ID is recognized. Effective writes: 1.
{"none":"The first effect did not commit and no replay arrived. Effective writes: {writes}.","first":"The next handling is the first commit. Effective writes: {writes}.","done":"No delivery is repeated. Effective writes: {writes}.","dedup":"The repeated ID is recognized. Effective writes: {writes}.","duplicate":"The earlier write cannot be identified. This gives {writes} effects."}Check your understanding
Choose an option to see the result and explanation.
Check, then explain in your own words
- Read the initial conditions and operational goal.
- Change one condition and compare the decision.
- Record the model boundary and outstanding checks.
Check your understanding: Use durable business event IDs to distinguish replay from a first commit.
Uses at most two deliveries of one synthetic ID and assumes atomic storage of result and ID. It omits real ordering, timing and concurrency.
Record the model boundary and outstanding checks.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
- Using Lambda with Amazon SQSChecked:
Scope and conditionsA failure between committing a side effect and acknowledging a message can cause reprocessing.
Used in this lessonWhat to predict Acceptance and limits