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
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
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