liveBook · Manning

Sink node

As explained in Grokking Software Architecture

A component that subscribes to topics and receives messages published to them.

A sink node, or subscriber, is a component that listens for messages and reacts when they arrive. In publish-subscribe messaging, it expresses interest in one or more topics and receives the messages published to them. section 7.2.3 section 7.2.1

Think of a subscriber as someone waiting for a doorbell, rather than repeatedly checking the door. A producer publishes an event without calling each subscriber directly; a broker sits between them and buffers messages. The producer can move on even when a consumer is offline, but processing happens later, so results may not be immediately consistent. section 7.2.1 section 7.9

One order, several reactions

An Order Service publishes OrderPlaced. A Shipping Service subscribes and prints a label; Rewards and Analytics subscribers add points and update a dashboard. The latter services can be added without changing the Order Service. section 7.2.3

Figure 7.5 Open/Closed Principle in action: We can add the Rewards and Analytics services without ever touching the code in the Order Service

The diagram shows how additional subscribers can react to an order without changes to the publisher. section 7.2.3

Subscribers need to handle the realities of asynchronous delivery:

  • Ordering: Events may arrive out of order across partitions. Use a suitable partition key and make consumers able to handle out-of-order events. section 7.4.2
  • Duplicates: With at-least-once delivery, retries can deliver the same event twice. An idempotent consumer can track processed event IDs and treat duplicates as no-ops. section 7.4.2
  • Failures: Acknowledgments support delivery, while a monitored dead letter queue catches messages that would otherwise repeatedly crash consumers. section 7.9

A slow worker

An AI agent can subscribe to TicketCreated, send the ticket to a language model asynchronously, save a draft, and publish TicketDrafted. The user need not wait for the analysis to finish. section 7.3.4

How Grokking Software Architecture covers it

How deep it goes
Defines the consumer role and explains ordering, duplicate delivery, idempotency, and failure-handling concerns.
Examples
Uses order-processing subscribers and an asynchronous AI support agent to illustrate distinct reactions to events.
What you can do after
Evaluate consumer designs for decoupling, delayed results, ordering, and duplicate delivery.
How it connects
Connects subscribers with publish-subscribe, message brokers, temporal decoupling, eventual consistency, and idempotency.

Also explained in

Compare how 7 books explain sink node →

Related concepts

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