Topics and subscriptions

Cloud Pub/Sub operates on the basis of topics and subscriptions. When submitting a message to Cloud Pub/Sub, the message is written to a specific topic. Any number of subscriptions may be attached to a given topic, forming a one-to-many relationship. For each subscription, Cloud Pub/Sub maintains a separate message queue. Each message posted to a given topic will be written to every subscription attached to that topic. As a result, Cloud Pub/Sub follows a publisher-subscriber messaging pattern, where publishers do not maintain any reference to recipients.

The publisher-subscriber messaging pattern has several advantages when working in complex systems. Because the publisher is not concerned with which services receive ...

Get Building Google Cloud Platform Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.