Stream Processing Pipeline - Using Pub/Sub

Опубликовано: 20 Март 2026
на канале: Cloudvala
120
5

GCP Pub/Sub, or Google Cloud Pub/Sub, is a messaging service provided by Google Cloud Platform that enables asynchronous communication between applications.

It allows applications to exchange messages in real-time or near real-time, without the need for the applications to be directly connected to each other. With Pub/Sub, publishers send messages to a "topic", and subscribers receive messages from that topic. This decoupled architecture allows for greater scalability, reliability, and flexibility in designing distributed systems.

Pub/Sub is a fully-managed service, meaning that Google handles the infrastructure, availability, and security of the service, allowing developers to focus on building their applications rather than managing messaging infrastructure. It can be used to build a variety of distributed systems, including streaming data pipelines, event-driven systems, and IoT applications.





Streaming data, also known as real-time data, refers to data that is generated continuously and rapidly, typically in large volumes, and is processed without any delay or buffering.

Streaming data can come from a wide range of sources, such as sensors, IoT devices, social media, website clickstreams, financial transactions, and more. The data is often time-sensitive and requires immediate processing and analysis in order to derive insights or take action.

Streaming data processing involves ingesting, processing, and analyzing data in real-time, and can include tasks such as filtering, aggregation, transformation, and machine learning. Streaming data platforms, such as Apache Kafka, Apache Flink, and Google Cloud Dataflow, provide tools and frameworks to handle the processing and analysis of streaming data.

The ability to process and analyze streaming data in real-time has numerous applications, such as real-time fraud detection, predictive maintenance, real-time personalization, and real-time monitoring of complex systems.


In Google Cloud Platform (GCP), Pub/Sub is a messaging service that allows decoupling of various applications and services by providing a reliable, scalable, and asynchronous communication system. The Pub/Sub service consists of two main components, namely publishers and subscribers.

Publishers are the applications or services that create messages and send them to a topic. In Pub/Sub, a topic is a named resource that represents a stream of messages. The publishers are responsible for sending messages to a specific topic.

Subscribers, on the other hand, are the applications or services that consume the messages sent to a topic. A subscriber must create a subscription to a topic to receive messages from it. A subscription is a named resource that represents the stream of messages from a single, specific topic, to be delivered to the subscribing application.

When a message is published to a topic, the Pub/Sub service delivers the message to all the subscribers that have an active subscription to that topic. The message delivery is asynchronous and can be done at different rates depending on the subscribers' capacity to receive and process messages.

The Pub/Sub service in GCP uses a publish-subscribe messaging model that enables decoupling of various applications and services. This model provides scalability, reliability, and flexibility to handle the increasing volume of messages and subscribers, making it suitable for various use cases.


what is difference berween kafka and pub-sub


Kafka and Pub/Sub are both distributed messaging systems used for decoupling applications and services. However, there are some fundamental differences between these two systems:

Architecture: Kafka is a distributed streaming platform that allows for real-time processing of data streams, whereas Pub/Sub is a messaging service that focuses on decoupling applications and services using a publish-subscribe model.

Scalability: Kafka is designed to handle high-throughput, high-volume data streams and is known for its ability to scale horizontally, whereas Pub/Sub is a fully managed service that automatically scales up or down based on the volume of messages.

Durability: Kafka stores messages on disk and allows for message replay in case of failures, making it suitable for use cases that require high durability, while Pub/Sub stores messages in memory and offers limited message retention.

Protocol Support: Kafka supports multiple protocols, including TCP, HTTP, and HTTPS, while Pub/Sub only supports HTTP/HTTPS.

Integration with Other Systems: Kafka integrates well with other big data systems like Hadoop, Spark, and Flink, while Pub/Sub integrates seamlessly with other GCP services such as Cloud Functions, Cloud Storage, and Cloud Dataflow.

Data Processing Capabilities: Kafka allows for real-time data processing using stream processing frameworks such as Kafka Streams and Apache Spark, whereas Pub/Sub is primarily focused on message delivery and does not have built-in stream processing capabilities.