Graph
Publish–Subscribe

📣Publish–Subscribe

NEW

Also known as: Pub/Sub

A messaging pattern where publishers send events to topics and subscribers independently consume them.

DESCRIPTION

Publish–subscribe is a messaging pattern that decouples senders from receivers via topics or channels. Publishers emit messages without addressing specific consumers, and subscribers receive messages from topics they are interested in. This enables scalable fan-out, loose coupling, and asynchronous communication across services. Pub/sub underpins event-driven architectures, streaming pipelines, and notification systems. Implementations include managed services and brokers that provide delivery guarantees, filtering, ordering, and access control. Pub/sub is foundational for microservices integration and near-real-time analytics.

ALTERNATIVE DEFINITIONS

Google Cloud

Pub/Sub is an asynchronous messaging service that decouples services that produce events from services that process events.

Emphasizes decoupling producers and consumers via a managed service.

Source

Confluent

Publish/subscribe (pub/sub) is a messaging pattern in which senders (publishers) send messages to a topic, and receivers (subscribers) consume messages from that topic.

Highlights use of topics as the indirection layer between publishers and subscribers.

Source

Microsoft Learn

Service Bus topics and subscriptions provide a publish-subscribe pattern in which a topic can have multiple, independent subscriptions to which copies of messages are sent.

Describes pub/sub using Azure Service Bus topics and multiple independent subscriptions.

Source

Message Broker Event Streaming Topic Consumer Group Producer Member Event-Driven Architecture Routing Fan-out

COMPETING TERMS

Queue Request–Response

KNOWLEDGE AREAS

Real-time & Streaming Data Data Integration & Interoperability Data Engineering Software Engineering Data Architecture

TARGET AUDIENCE

Software Developer Data Engineer Data Architect Cloud Architect DevOps Engineer

EXTERNAL SOURCES

TOP QUESTIONS

What problem does Publish–Subscribe solve?

Publish–Subscribe decouples producers and consumers, enabling scalable fan-out and asynchronous communication. It avoids tight coupling and direct addressing, improving resilience and evolvability of distributed systems.

Category: Purpose

How does Publish–Subscribe differ from a Message Queue?

In pub/sub, multiple subscribers can receive the same message through topics. In point-to-point queues, each message is consumed by a single consumer competing in a consumer group.

Category: Comparison

When should I use Publish–Subscribe?

Use pub/sub for broadcasting events to many consumers, building event-driven microservices, and real-time notifications where decoupling and fan-out are required.

Category: Usage

What are common mistakes with Publish–Subscribe?

Overloading topics with unrelated events, poor schema versioning, and ignoring delivery guarantees lead to coupling, consumer breakage, and inconsistent processing.

Category: Mistakes

What delivery guarantees exist in Publish–Subscribe systems?

Common guarantees include at-most-once, at-least-once, and exactly-once semantics, varying by platform and configuration.

Category: Concepts

How does ordering work in Publish–Subscribe?

Ordering is often guaranteed per key or partition, not globally. Systems like Kafka provide per-partition ordering; some services offer ordering keys.

Category: Concepts

Why is Publish–Subscribe central to event-driven architecture?

It enables services to react to events without direct dependencies, facilitating autonomous teams, scalability, and real-time data propagation.

Category: Relevancy

How do I secure a Publish–Subscribe system?

Use authentication, authorization per topic, encryption in transit and at rest, and audit logging. Isolate sensitive topics and apply least privilege.

Category: Security

What is a hot topic around Publish–Subscribe today?

Serverless event routers, schema registries for governance, and event-driven data products are gaining traction, alongside cloud-native pub/sub services.

Category: Topic