Skip to main content

System Architectural Styles

Pub/Sub Architecture

0:00
LearnStep 1/4

What is Pub/Sub Architecture?

What is Pub/Sub Architecture?

The Publish-Subscribe (Pub/Sub) architecture is a messaging pattern where message senders (publishers) do not send messages directly to specific receivers. Instead, publishers send messages to an intermediary called a topic, and interested receivers (subscribers) register to receive messages from that topic.

This pattern is foundational to modern distributed systems, enabling loose coupling, scalability, and asynchronous communication between services.

Pub/Sub Architecture Diagram

plaintext

Core Components

  • Publisher: Produces messages and sends them to a topic. Publishers are unaware of which subscribers exist.
  • Topic (Channel): A named category or feed to which messages are published. Acts as the intermediary.
  • Message Broker: The infrastructure component that manages topics, receives messages from publishers, and delivers them to subscribers.
  • Subscriber: Registers interest in one or more topics and receives messages published to those topics.

Pub/Sub vs Point-to-Point Messaging

plaintext