APNs said 200. Then the worker died.
transcript
APNs says 200. Arjun's push is out. Then the worker dies. Before it writes done. Its replacement has one question. Did that push go out?
Mark it done first, then send? Crash in between, and the message is lost. Send first, then mark done? Crash, and it goes out twice. There's no third order.
So just promise exactly-once, right? Here's the catch. Kafka's docs say it needs the other side's cooperation. APNs won't. An SMS carrier won't.
So pick at-least-once. First, claim the task key, with an expiry. Send. The one step you can't undo. Then record done. Crash before done? The claim expires, and it's sent again. By design.
But both pushes carry the same collapse ID. So the second replaces the first. Arjun sees one. And his inbox row was written once. Only the doorbell rang twice.
Exactly-once really means at-least-once. Plus dedup at every hop. Plus collapse IDs. That's the honest promise. Say it in the interview.
Full breakdown in the lecture.