0
0
GCPcloud~30 mins

Message retention and acknowledgment in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Message retention and acknowledgment
📖 Scenario: You are setting up a Google Cloud Pub/Sub topic and subscription for a simple messaging system. You want to control how long messages are kept and ensure messages are acknowledged properly to avoid duplicates.
🎯 Goal: Build a Pub/Sub topic and subscription with a message retention duration of 7 days and configure the subscription to require explicit message acknowledgment.
📋 What You'll Learn
Create a Pub/Sub topic named my-topic
Create a Pub/Sub subscription named my-subscription attached to my-topic
Set the message retention duration of the topic to 7 days
Configure the subscription to require explicit acknowledgment of messages
💡 Why This Matters
🌍 Real World
Message retention and acknowledgment settings are crucial for reliable message processing in distributed systems, ensuring no messages are lost or processed multiple times.
💼 Career
Understanding Pub/Sub configuration is important for cloud engineers and developers working with event-driven architectures and asynchronous communication.
Progress0 / 4 steps
1
Create the Pub/Sub topic
Create a Pub/Sub topic named my-topic using the Google Cloud SDK command gcloud pubsub topics create my-topic.
GCP
Need a hint?

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

2
Create the Pub/Sub subscription
Create a Pub/Sub subscription named my-subscription attached to the topic my-topic using the command gcloud pubsub subscriptions create my-subscription --topic=my-topic.
GCP
Need a hint?

Use the gcloud pubsub subscriptions create command with the --topic flag.

3
Set message retention duration
Update the topic my-topic to set the message retention duration to 7 days (604800 seconds) using the command gcloud pubsub topics update my-topic --message-retention-duration=604800s.
GCP
Need a hint?

Use the gcloud pubsub topics update command with the --message-retention-duration flag set to 604800s.

4
Configure acknowledgment requirement
Ensure the subscription my-subscription requires explicit acknowledgment by setting the --ack-deadline to 10 seconds using the command gcloud pubsub subscriptions update my-subscription --ack-deadline=10.
GCP
Need a hint?

Use the gcloud pubsub subscriptions update command with the --ack-deadline flag set to 10 seconds.