concept

Pub/Sub vs Point-to-Point messaging

created 2026-05-25 messaging · pub-sub · queues · distributed-systems · patterns

Pub/Sub vs Point-to-Point messaging

The first question to ask before reaching for any messaging tool: should this message be handled once, or should multiple services react to it? Getting this wrong is how a single welcome email becomes 50 welcome emails per signup.

The two semantics

PatternQuestion it answersWhat happens
Point-to-point (work queue)“Do this thing.”Any consumer can grab the message, but only one does. Resize this image. Charge this card. Send this one email.
Pub/Sub (topic, fan-out)“This thing happened.”Each subscriber gets its own copy of the message and reacts independently. An order was placed → inventory updates, email is sent, analytics is recorded.

The mistake to avoid

The canonical horror story: a team put a “send welcome email” job onto a topic. The topic correctly fanned the message out to all 50 workers. 50 workers, 50 copies, 50 emails per signup. The tool wasn’t broken — the semantics were wrong.

One question, asked once in review, prevents it:

Should this message be handled once, or should multiple services react to it?

Vocabulary is unreliable

People say “put it on the Kafka queue” or “the RabbitMQ topic” and mean different things on different days. Don’t argue about the word — ask what actually happens to a message when it arrives.

A useful mental model:

  • Point-to-point = one logical inbox, multiple workers competing for messages.
  • Pub/Sub = N logical inboxes, one per subscriber, each receiving a copy.

Tooling map

ToolNative shapeOther shape via…
kafkaLog (replay) — works for both; Kafka 4.0 share groups added queue semantics nativelyConsumer groups for work-queue behavior
rabbitmqBroker with exchanges that route to queues — both shapes via exchange types (direct, topic, fanout, headers)n/a (both first-class)
sqsPoint-to-point queue, no fan-out built inPair with SNS for fan-out, or use EventBridge/Kinesis
bullmq, pgmqPoint-to-point work queuesApplication-level fan-out only

See also