Dead-Letter Topics & Retry Policies: Proving Failed Pub/Sub Messages Land Safely
Advanced · 30 minutes · 5 tasks, checked automatically · 100 points
In this advanced Pub/Sub lab you will build a complete dead-letter (DLQ) pipeline entirely on the local GCP emulator. You will create a primary topic and a dead-letter topic, attach a subscription with a strict retry policy and a dead-letter policy, publish messages that a simulated consumer deliberately refuses to acknowledge, and then prove those undeliverable messages accumulate in a separate dead-letter subscription. By the end you will have hands-on experience with every knob that controls Pub/Sub failure handling: max delivery attempts, minimum/maximum backoff, and the dead-letter topic wiring.
What you’ll learn
- Create a primary Pub/Sub topic and a dedicated dead-letter topic
- Configure a subscription with a dead-letter policy (max 5 delivery attempts) and an exponential retry policy (1 s – 10 s backoff)
- Publish messages, simulate consumer NACKs by letting deliveries exhaust, and confirm the messages appear in the dead-letter subscription
How this lab works
- Start the lab: One click starts an emulated cloud on your computer, with the cloud’s own CLI ready: no account and no bill.
- Work through 5 tasks: Each task says what to build or fix. You do it yourself, in a real terminal, with hints when you get stuck.
- Check your work: Check my work reads the emulated cloud’s resources and says, task by task, what passed and what to fix.
- Finish and keep going: 100 points, your progress saved, and the next lab to try.
What it runs on
- Runs: An emulated cloud on your computer: no cloud account, no bill
- Cloud: GCP
- Services: pubsub
What you need
- A free LearnXops account
- The LearnXops desktop app for macOS, Windows or Linux
- Docker Desktop (or Podman / Rancher Desktop) installed and running
- A GCP sandbox created in the Local Cloud Playground
Topics: pubsub, dead-letter, retry-policy, messaging, gcp, emulator, reliability
Create a free account to start this lab.
Keep going
- Produce and Consume from a Managed Kafka Topic with Consumer Groups and Offset Handling
- Stream Events Through Event Hubs with Consumer Groups and Checkpointing
- Dead-Letter Queues and Retry Policies on Service Bus
- Stream Partitions, Message Ordering and Offset Handling Under Load
- SNS Fan-Out Architecture: Filter Policies Across Multiple SQS Queues
- Catch Failed Messages with an SQS Dead-Letter Queue and Redrive Policy