Topics and Subscriptions
The core logic of Pub/Sub relies on routing data accurately from services.
Concept Flow
- A Publisher creates a message and sends it to a specific Topic.
- A Topic acts as a broadcasting channel.
- A Subscription connects to a topic and receives broadcasts from it.
Push vs Pull Subscriptions
- Push: Pub/Sub automatically fires an HTTP POST request to a Webhook URL you provide as soon as a message hits the Topic. Excellent for Serverless APIs.
- Pull: The subscribing worker server manually reaches out to the Pub/Sub API and asks "Are there any new messages for me?" Excellent for securing internal VPC workers that lack public endpoints.