liveBook · Manning

Publish/subscribe model

As explained in Apache Kafka in Action

A publish-subscribe model lets publishers send messages to named channels while subscribers independently receive messages from those channels.

A publish/subscribe model lets services exchange data asynchronously without depending tightly on one another’s internal data models. Producers publish messages to named topics, while consumers receive and process them independently. section 1.1 section 17.1

Kafka strengthens this pattern by persisting published data. Consumers can read messages multiple times over hours, days, or months, supporting real-time processing as well as later analysis. section 1.1

Kafka organizes the flow through a small set of cooperating parts:

  • Topics provide named channels or categories for messages. section 1.6
  • Partitions divide topics so processing can run in parallel and scale. section 1.6
  • Brokers store, distribute, and retrieve messages within the Kafka cluster. section 1.6
  • Replication improves resilience when parts of the system fail, while additional brokers provide horizontal scale. section 1.6

One stream, multiple business uses

A retailer can publish inventory and order events through Kafka. Independent consumers can process those events for inventory management, order processing, analytics, or customer-facing workflows without requiring a shared internal data model. section 1.1 section 1.6

Figure 17.1 We differentiate between service-internal data, that is, data on the inside, and data exchanged between services, that is, data on the outside.
A red and green paper with black text

AI-generated content may be incorrect.

Use the service-internal versus service-external data distinction to see where publish/subscribe fits: Kafka carries durable data exchanged between services rather than data kept inside one service. section 17.1

How Apache Kafka in Action covers it

How deep it goes
Explains producers, consumers, topics, partitions, brokers, persistence, replication, and scaling, but not client implementation details.
Examples
Uses finance, manufacturing, retail, fraud detection, inventory management, order processing, and network monitoring examples.
What you can do after
Apply it via Apache Kafka to connect producers and consumers, distribute events, and support scalable real-time data flows.
How it connects
Connects producers, consumers, topics, partitions, brokers, replication, microservices, event sourcing, and stream processing.

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 Apache Kafka in Action. The section links point to the parts of the book it draws on.