Pubsub

  • date 31st May, 2021 |
  • by Prwatech |
  • 0 Comments

Google Cloud Pub/Sub messaging service

 

Google Cloud Pub/Sub is a fully managed messaging service offered by Google Cloud Platform (GCP) that enables asynchronous communication between applications and services. It provides scalable and reliable messaging infrastructure for building real-time and event-driven systems, facilitating seamless data exchange and event notification across distributed environments.

At its core, Google Cloud Pub/Sub follows a publish-subscribe messaging model, where publishers send messages to topics, and subscribers receive messages from these topics. Topics act as communication channels or categories, while subscribers are entities that consume and process messages from these topics.

One of the key features of Google Cloud Pub/Sub is its scalability and high availability. It can handle millions of messages per second and automatically scales to accommodate fluctuations in message volume, ensuring reliable message delivery even under heavy loads.

Prerequisites

GCP account

Open Console.

Click on Activate Cloud shell

$ gcloud pubsub topics create <topic name>                #Create Topics

gcloud pubsub subscriptions create –topic <topic name> <subscription name>                   #Create Subscription

gcloud pubsub topics publish <topic name> –message “Welcome to Prwatech”                  #Publish Message

$ gcloud pubsub subscriptions pull –auto-ack <subscription name>                    #Display the subscription

In console, Open Menu > Pub/Sub > Topics

Open the topic which we created.

Click on View Messages.

Select the Created Subscription.

Click Pull.

The message displayed.

NB: The validity of one message is 10 seconds. If the message is not displayed, Execute the below command and check it within 10 seconds.

1
0

Quick Support

image image