The Desi Architect
Notes / Docker Sandboxes / Queue Basics: Your First Queue, Acknowledgements and Duplicate Messages
Docker Sandboxes · Tier 1: Building Blocks · Lab 17

Queue Basics: Your First Queue, Acknowledgements and Duplicate Messages

Build a queue from a Redis list. Watch workers share jobs, lose a job when a worker crashes, fix it with an acknowledgement step, and meet the price of that fix: the same job can run twice, and what to do about it.

Time30 minutes
StackRedis 7Ports 16412
MemoryAbout 15 MB
Before thisLab 06Redis Basics
Verified runWindows, Mac, LinuxBash and PowerShell
  1. 1PrepareWhat you will learn
  2. 2PredictGuess before you run
  3. 3RunStep by step
  4. 4ObserveWhat you should see
  5. 5Break itChange one thing
  6. 6Clean upLeave nothing running
On this page
  1. 00 / What You Will Learn
  2. 01 / Why It Matters
  3. 02 / What We Are Building
  4. 03 / Words You Need
  5. 04 / Predict First
  6. 05 / Step by Step
  7. 06 / What You Should See
  8. 07 / Look Inside
  9. 08 / Break It, Fix It
  10. 09 / In Real Projects
  11. 10 / Interview Corner
  12. 11 / Clean Up

00 /What You Will Learn

By the end you will be able to
  • Say what a queue, a producer and a consumer are, and why apps use queues.
  • Show that several consumers share work and that each job goes to one of them.
  • Reproduce a lost job when a consumer crashes.
  • Fix it with an acknowledgement and a visibility timeout, and see a crashed job come back.
  • Explain at-least-once delivery and why jobs must be idempotent.

Before you start

Finish Lab 06 (Redis Basics) first. You should know RPUSH, LPOP and what a Redis list is. Docker Desktop must be running. No queue software is needed, because the queue in this lab is a Redis list.