0
0
GCPcloud~30 mins

Topics and subscriptions in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Create and Configure Pub/Sub Topics and Subscriptions in GCP
📖 Scenario: You are setting up a messaging system in Google Cloud Platform (GCP) using Pub/Sub. This system will allow different parts of your application to communicate by sending and receiving messages asynchronously.First, you will create a topic where messages can be published. Then, you will create a subscription to that topic so that messages can be received and processed.
🎯 Goal: Build a Pub/Sub topic named news-updates and a subscription named news-subscriber that listens to this topic.
📋 What You'll Learn
Create a Pub/Sub topic called news-updates.
Create a subscription called news-subscriber for the news-updates topic.
Set the subscription's acknowledgment deadline to 20 seconds.
Use the Google Cloud SDK gcloud commands in the correct order.
💡 Why This Matters
🌍 Real World
Messaging systems in cloud applications often use Pub/Sub to decouple components and handle asynchronous communication.
💼 Career
Cloud engineers and developers use Pub/Sub topics and subscriptions to build scalable, event-driven architectures.
Progress0 / 4 steps
1
Create the Pub/Sub topic
Use the gcloud pubsub topics create command to create a topic named news-updates.
GCP
Need a hint?

Remember the command format: gcloud pubsub topics create [TOPIC_NAME].

2
Create the subscription variable
Create a variable called SUBSCRIPTION_NAME and set it to news-subscriber.
GCP
Need a hint?

Use the syntax VARIABLE_NAME=value to create a variable in shell.

3
Create the subscription with acknowledgment deadline
Use the gcloud pubsub subscriptions create command to create a subscription named news-subscriber for the topic news-updates. Set the acknowledgment deadline to 20 seconds using the --ack-deadline flag.
GCP
Need a hint?

Use --ack-deadline=20 to set the acknowledgment deadline to 20 seconds.

4
Verify the subscription configuration
Use the gcloud pubsub subscriptions describe command with the subscription name news-subscriber to verify the subscription exists and has the correct acknowledgment deadline.
GCP
Need a hint?

This command shows the subscription details including the acknowledgment deadline.