Records in a stream can arrive twice. How should the consumer behave?
Why B is the answer
Process them idempotently
At-least-once delivery requires safe reprocessing.
In detail
- Idempotent processing means a repeat does no harm.
- Assume that duplicates will happen.
Use case
An illustrative scenario, not a real incident.
A retry delivers one payment twice. The consumer checks the record ID, so the balance changes only once.
See it in different ways
sequenceDiagram participant P as Producer participant K as Kinesis Data Streams participant A as Consumer A participant B as Consumer B P->>K: Records K->>A: Reads from its own position K->>B: Reads from its own position A->>A: Processes idempotently
flowchart TD
Q{"Have you seen this record ID?"}
Q -->|"No"| A0["Process"]
Q -->|"Yes"| A1["Ignore"]Key point: At-least-once delivery needs idempotent consumers.
Why the other options are wrong
- A. Delete the whole stream
- Deleting the stream loses data.
- C. Assume that each arrives only once
- Duplicates do happen.
- D. Stop after the first duplicate
- Stopping halts the pipeline.

