tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Cloud Platforms > Google Cloud Platform (GCP) > Cloud Pub/Sub

Cloud Pub/Sub

Author: Venkata Sudhakar

Google Cloud Pub/Sub is a fully managed, real-time messaging service that allows you to send and receive messages between independent applications. It is a scalable, durable event ingestion and delivery system that serves as the backbone for streaming analytics and event-driven systems.

Key Concepts:

1. Topic - A named resource to which messages are sent by publishers.

2. Subscription - A named resource representing the stream of messages from a topic.

3. Publisher - An application that creates and sends messages to a topic.

4. Subscriber - An application that receives messages from a subscription.

5. Message - The combination of data and optional attributes that a publisher sends.

The below example shows how to publish and subscribe to messages using the Java client library.


It gives the following output,

Published message ID: 7661234567890123
Received: Hello from Cloud Pub/Sub!
Attributes: {source=java-example}

Delivery Modes:

Push delivery - Pub/Sub sends messages to a specified HTTPS endpoint (webhook). Best for low-latency real-time processing.

Pull delivery - Subscribers explicitly call the API to pull messages. Best for large volumes where subscribers control the processing rate.


 
  


  
bl  br