PubSub messaging service in Google Cloud GCP

Pubsub is a real time messaging service provided by Google. The idea is to use a messaging service where you just need to push your data and who so ever is intended to receive the data will just need to subscribe it and will keep on getting the data. This is a serverless feature it means you don’t need to host anything anywhere just need to publish the data and that’s all. It’s a secure, scalable, guaranteed delivery (at least once) and globally available environment.

Why its different than web service call

During your web service call you are consuming the resource of your web server. It’s a request response practices where your server will send the request and will wait for response. But here in case of pub sub you just have to use this service to push the data and receivers will automatically receive it. And there is no load on your web server.

Use case of PubSub in GCP

  • Create a data pipeline
  • Interact between one environment to another
  • In ecommerce if you want that once the order is placed then data should be passed to drop shipper
  • Video streaming
  • Check Real-time personalization in gaming
  • Check Fast reporting, targeting and optimization in advertising and media
  • Check Processing device data for healthcare, manufacturing, oil and gas, and logistics
  • Check Syndicating market-related data streams for financial services

PubSub Concepts in GCP

Topic: These are the publishers who post/send the data.
Subscription: These are the subscribers who receive the data. There are two types of subscription available in pub/sub
 pull based : Where you need to pull the data as a subscriber.
 push based : Where you will provide an endpoint and your data will be directly pushed to that end point. In this case often we push the data to db (like dbstore ) and when endpoint comes then it just fetch the data from db and do the process whatever required.

Snapshot:It captures the message acknowledgment state of a subscription at a given time.
Endpoint: in order to configure the endpoint you need to have your own url (should have ssl certification enabled) and authorization should be done. Otherwise just for testing purpose we can use app engine url on same project.

Endpoint: in order to configure the endpoint you need to have your own url (should have ssl certification enabled) and authorization should be done. Otherwise just for testing purpose we can use app engine url on same project (its somewhat relaxed version to use it)

How can we use pubsub in GCP

  • Through command line
  • Through API
The following two tabs change content below.

Chandra Shekhar

GCP Architect
Chandra Shekhar Pandey is Google certified Cloud engineer, I am Magento2 Trained developer. Having huge experience in designing cloud solution. I have around 12 years of experience with world enterprise IT companies and fortune 500 clients. During my architecture design I am always caring about high availability, fast performance and resilient system. From the programmer background I have huge experience in LAMP stack as well. Throughout my carrier I have worked on Retail, E-Learning, Video Conferencing and social media domain. The motive of creating cutehits was just to share the knowledge/solutions I get to know during my day to day life so that if possible I can help someone for same problems/solutions. CuteHits.com is a really a very effort for sharing knowledge to rest of the world. For any query/suggestion about same you can contact me on below details:- Email: shekharmca2005 at gmail.com Phone: +91-9560201363

Latest posts by Chandra Shekhar (see all)

You may also like...