Card 09/ 09

RecapDifficulty: Intermediate1 min

Recap: Queues and Publish/Subscribe

Not waiting, one reader or many, and the duplicate to expect.

  • Wait only for what the reply depends on, and hand off the rest (Synchronous and Asynchronous Communication).
  • A queue gives each message to one worker, and keeps it until acknowledged (Message Queues: Work Handed Off for Later).
  • A queue absorbs a burst: backlog divided by rate is the wait (Queue Example: Absorbing a Burst of Uploads).
  • A topic gives every subscriber its own copy, and the publisher knows none of them (Publish/Subscribe: One Event, Many Independent Readers).
  • New subscribers need no change to the publisher (Pub/Sub Example: One Order Event, Three Services).
  • Share the work with a queue; share the news with a topic (Message Queue vs Publish/Subscribe).
  • At-least-once means sometimes twice, so make consumers safe to repeat (At-Least-Once Delivery Means Sometimes Twice).