BuildMidBackendAuto-graded
Stop a redelivered message from being handled twice
A queue worker must ignore repeat deliveries and still retry work that genuinely failed, and that distinction is the difficulty.Your message queue delivers at least once. That is the contract, not a bug: when the broker does not receive your ack in time, it redelivers the same message with the same id. The consumer here treats every delivery as new, so a redelivery runs the handler twice. Make it deduplicate — while keeping a genuine failure retryable, which is the subtlety: a message that failed must not be recorded as handled.30 min
python
You're done when
- A redelivered message runs the handler only once.
- The redelivery returns a response identical to the original.
- That response is the stored original rather than a recomputed one.
- A message whose handler failed and later succeeds on redelivery deduplicates normally from then on.
What it measures
Event-driven architectureBuilding a consumer that is correct under the at-least-once delivery its broker actually provides.
Resilience engineeringDistinguishing 'already done' from 'failed and should be retried', which is what makes dedup safe rather than lossy.
State designChoosing what to record and exactly when, so the dedup store never marks work complete that never completed.
Your environment
Terminal + editorA full shell in the browser
Claude CodePre-authenticated, no key setup
Isolated microVMYours alone, wiped afterwards
Start this lab
30 min
Start labYou'll sign in to Anthropos to start. The lab opens in a private cloud workspace with Claude Code ready to use.AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo