0
0
GCPcloud~15 mins

Dead letter topics in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Setting Up Dead Letter Topics in Google Cloud Pub/Sub
📖 Scenario: You are managing a messaging system using Google Cloud Pub/Sub. Sometimes, messages fail to be processed correctly. To handle these failures safely, you want to create a special topic called a dead letter topic where failed messages will be sent for later inspection.
🎯 Goal: Build a Pub/Sub subscription with a dead letter topic configured. This setup ensures that messages that cannot be processed after a certain number of attempts are moved to the dead letter topic automatically.
📋 What You'll Learn
Create a Pub/Sub topic named main-topic
Create a Pub/Sub topic named dead-letter-topic
Create a subscription named main-subscription to main-topic
Configure main-subscription with deadLetterPolicy pointing to dead-letter-topic
Set the maximum delivery attempts to 5
💡 Why This Matters
🌍 Real World
Dead letter topics help keep messaging systems reliable by isolating messages that cannot be processed, so they don't block the flow of good messages.
💼 Career
Understanding dead letter topics is important for cloud engineers and developers working with event-driven architectures and message queues to build fault-tolerant systems.
Progress0 / 4 steps
1
Create the main Pub/Sub topic
Write the gcloud command to create a Pub/Sub topic named main-topic.
GCP
Need a hint?

Use the gcloud pubsub topics create command followed by the topic name.

2
Create the dead letter Pub/Sub topic
Write the gcloud command to create a Pub/Sub topic named dead-letter-topic.
GCP
Need a hint?

Use the same command as before but with the new topic name.

3
Create the subscription to the main topic
Write the gcloud command to create a subscription named main-subscription to the topic main-topic.
GCP
Need a hint?

Use gcloud pubsub subscriptions create with the subscription name and --topic flag.

4
Configure the subscription with dead letter topic and max delivery attempts
Write the gcloud command to update the subscription main-subscription to set the dead letter topic to dead-letter-topic and set the maximum delivery attempts to 5.
GCP
Need a hint?

Use gcloud pubsub subscriptions update with --dead-letter-topic and --max-delivery-attempts flags. The dead letter topic must be specified with its full resource name.