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. 1Watch messages sorted by ride.
  2. 2Guess what happens when they're sorted by type.
  3. 3Keep each ride in order even when a tube is busy.