Cloud PubSub Flashcards
What is Cloud PubSub?
A fully managed messaging middleware service
Cloud PubSub key points (5)
- Allows messages between independent apps either within or outside of Google Cloud
- One to many, many to one, many to many
- Both push and pull messages.
- Messages are encrypted and HIPPA compliant
- Durable messaging - the messages will be kept as long as it is needed
What are some use cases for Cloud PubSub? (3)
- Streaming data
- Event notifications
- Service to service communication to set up asynchronous workflows
How does Cloud PubSub work?
- The publisher sends a message.
- The message belongs to a topic.
- The topic has subscriptions attached to it.
- Subscribers can be subscribed to a particular subscription so that they will get the message.
- The subscriber sends an acknowledgement back to the subscription.
- Pub/Sub will wait the period of time set in the acknowledgement Deadline parameter (10-600 seconds) or specified by the retention period (the length of time to keep an un-deliverable message). After this time, the message will be deleted
What delivery types are there for subscriptions in Cloud PubSub?
Push and Pull.
Pull -an application reads messages for a given subscription topic
Push - a subscription writes messages to an endpoint URL
How do you create subscriptions or topics via the shell for Cloud PubSub?
gcloud pubsub topics create [TOPIC NAME]
gcloud pubsub subscriptions create [SUBSCRIPTION NAME]
How do you send data to a topic via the shell in Cloud PubSub?
gcloud pubsub topics publish [TOPIC NAME] –message [MESSAGE]
How do you pull messages sent to a subscription in Cloud PubSub?
gcloud pubsub subscriptions pull –auto-ack [SUBSCRIPTION NAME]