0
0
GCPcloud~15 mins

Pull vs push subscriptions in GCP - Hands-On Comparison

Choose your learning style9 modes available
Understanding Pull vs Push Subscriptions in Google Cloud Pub/Sub
📖 Scenario: You are working on a cloud messaging system using Google Cloud Pub/Sub. You want to understand how to create and configure pull and push subscriptions to receive messages from a topic.
🎯 Goal: Build two subscriptions for a Pub/Sub topic: one pull subscription and one push subscription with a specified endpoint.
📋 What You'll Learn
Create a Pub/Sub topic named my-topic
Create a pull subscription named my-pull-subscription for my-topic
Create a push subscription named my-push-subscription for my-topic with push endpoint https://example.com/push
💡 Why This Matters
🌍 Real World
Cloud Pub/Sub is used to decouple services by sending messages asynchronously. Pull and push subscriptions are two ways to receive these messages depending on your application's needs.
💼 Career
Understanding how to configure pull and push subscriptions is essential for cloud engineers and developers working with event-driven architectures on Google Cloud.
Progress0 / 4 steps
1
Create the Pub/Sub topic
Create a Pub/Sub topic named my-topic using the gcloud command.
GCP
Need a hint?

Use gcloud pubsub topics create my-topic to create the topic.

2
Create a pull subscription
Create a pull subscription named my-pull-subscription for the topic my-topic using the gcloud command.
GCP
Need a hint?

Use gcloud pubsub subscriptions create my-pull-subscription --topic=my-topic to create the pull subscription.

3
Create a push subscription
Create a push subscription named my-push-subscription for the topic my-topic with the push endpoint https://example.com/push using the gcloud command.
GCP
Need a hint?

Use gcloud pubsub subscriptions create my-push-subscription --topic=my-topic --push-endpoint=https://example.com/push to create the push subscription.

4
Verify subscriptions
Use the gcloud command to list all subscriptions for the topic my-topic to verify both subscriptions exist.
GCP
Need a hint?

Use gcloud pubsub subscriptions list --topic=my-topic to see all subscriptions for the topic.