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.