← Lessons

quiz vs the machine

Silver1050

System Design

Point to Point vs Publish Subscribe

Two ways a broker delivers a message: to exactly one worker or to every interested party.

4 min read · intro · beat Silver to climb

Two delivery shapes

A message broker connects producers and consumers, but it can route in two very different ways.

  • In point to point, each message lands on a queue and is delivered to exactly one consumer. If you add more consumers, they share the load and each message is still handled once. This is the classic work queue.
  • In publish subscribe, a producer sends to a topic and every subscriber gets its own copy. One event fans out to many independent readers.

When to pick which

  • Use point to point for tasks that must be done once, like resizing an uploaded image or charging a card. Adding workers scales throughput without duplicating work.
  • Use publish subscribe for events that several systems care about, like an order placed event that billing, search, and email all react to.

A subtle point: pub sub gives each subscriber group its own copy, but within a group the workers still share the load like a queue.

Key idea

Point to point delivers each message to one worker for shared tasks while publish subscribe fans every event out to all interested subscribers.

Check yourself

Answer to earn rating on the learn ladder.

1. In point to point delivery, how many consumers process a given message?

2. Which pattern fits an order placed event that billing, search, and email all need?