liveBook · Manning

Publish/subscribe model

As explained in Kafka for Architects

A publish-subscribe pattern is a messaging pattern in which publishers send messages to subscribers without requiring direct knowledge of the subscribers.

A publish/subscribe model decouples message producers from consumers. Producers publish events without direct knowledge of subscribers, while each subscribed consumer receives and processes the message independently. section 1.4.1 section 5.2.1

Architectural consequences include:

  • Producers typically publish in a fire-and-forget manner, optionally receiving delivery acknowledgment. section 1.4.1
  • A message published to a Kafka topic remains available to all subscribed consumers, rather than being assigned exclusively to one consumer. section 5.2.1
  • Kafka suits asynchronous, event-driven workflows but does not naturally fit request-response or point-to-point requirements. section 5.2.1 section 7.0
  • Producers own the event structure, so explicit business requirements and reusable notifications support coordination and governance. section 1.4.1

Customer address updates

CustomerService stores a changed address and publishes a customer-updated event. BillingService, AnalyticalService, and OrderService subscribe independently: billing updates payment information, analytics refreshes reports, and ordering maintains accurate delivery data. If consumers need different views, a processing service can route the raw event into tailored shipping-address and billing-address topics. section 1.4.1 section 1.5.3

Figure 1.5 Publish-subscribe example: CustomerService publishes a “customer updated” event to a channel; all subscribers receive it independently.
A black screen with white boxes

Description automatically generated

Diagram the CustomerService publisher, a channel, and multiple subscribers receiving the customer-updated event independently. section 1.4.1

How Kafka for Architects covers it

How deep it goes
Defines producer and subscriber roles, contrasts point-to-point delivery, and addresses routing and governance without implementation walkthroughs.
Examples
Uses customer address events, Kafka topics, independent business-service subscribers, and content-based routing into billing and shipping topics.
What it assumes
Assumes familiarity with producers, consumers, services, and Kafka topics while defining their publish-subscribe roles.
What you can do after
Apply via Kafka by publishing reusable events, subscribing services independently, and routing differently shaped messages through processing services.
How it connects
Connects event-driven architecture, asynchronous messaging, point-to-point messaging, request-response, stream processing, and data governance.

Also explained in

Compare how 5 books explain publish/subscribe model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka for Architects. The section links point to the parts of the book it draws on.