Skip to main content
πŸ”’ Preview mode. The first 15 Foundations lessons are free; this one is Pro. Start a 7-day trial to unlock the editor, AI hints and the the rest of the curriculum. Card required, cancel any time in Dashboard.Start 7-day trial β†’
⚑
← Coursesβ€ΊSystem Design for Python JuniorsModule 4 Β· Messaging + microservices Β· Recapβ€ΊπŸŽ― Review: System design module 4 recapscenario80 / 105
+80 XP
Task
Build a small `dead_letter_handler(msg, retry_count, max_retries)` that returns one of `"retry"`, `"deadletter"`, or `"drop"`: 1. `msg.get("malformed", False) is True` β†’ `"drop"` (never retry corrupt input β€” it'll fail forever). 2. `retry_count < max_retries` β†’ `"retry"` (still under the budget). 3. `retry_count == max_retries` β†’ `"deadletter"` (used up the budget β€” route to DLQ for ops review). 4. `retry_count > max_retries` β†’ `"drop"` (already DLQ'd; subsequent failures drop silently to stop noise). This pattern is what protects every production queue from poison-message storms.
✏️ Write your code here
🐍
Loading Python...
One-time download (~1 MB). Then it runs instantly.
πŸ“Š Result
Press Run to see result...

πŸ’¬ Discussion

Be the first to ask a question or share a tip.
Sign in to join the discussion. Reading is free.
Loading discussion…