Distributed

Lesson 03.8

Queues vs pub/sub, partition keys, slow consumers

A queue gives each message to one consumer, pub/sub gives every subscriber its own copy, and a partition key decides which messages stay in order together.

Messages in two tubes

Every taxi ride sends four messages: asked, accepted, picked up, finished. They travel to the office down two tubes, and each tube delivers its messages in order. Ava works out the fares; Ben keeps the big map up to date. Each gets a copy of every message.

Which tube should each message go down?

In this lesson you'll

  1. 1Explain when a message goes to one worker and when to every group, and why order only holds inside one line
  2. 2Watch messages sorted by ride.
  3. 3Guess what happens when they're sorted by type.
  4. 4Keep each ride in order even when a tube is busy.