The queue — head, tail, enqueue, dequeue

A queue is a FIFO strip with a tail where producers enqueue and a head where consumers dequeue; the broker, not the consumer, decides which cell goes where.

Previously

We named the rule — reads delete, broker tracks state. Now we draw the strip properly: tail on the right where producers push, head on the left where consumers pull, and the FIFO order between them.

Scene 03

The queue — head, tail, enqueue, dequeue

  1. Watch
  2. Try it
  3. Predict
  4. Capture
BROKERheadtailProducerproducerenqueueConsumerconsumerdequeuedepth = 0
What to watch for

The producer pushes a new cell onto the tail every beat. After a few cells land, the consumer starts pulling cells off the head — in the same order they were enqueued.

Continue unlocks when the animation finishes.

Where this sits in Build a Message Queue (RabbitMQ / SQS)

Scene 03 of 14. Tail on the right where producers push, head on the left where consumers pull, and the FIFO order between them.

Up next. One producer, one consumer — fine. But a single worker can't keep up with the tail when the work is slow. What happens when we point N workers at the same head?

All 14 scenes in Build a Message Queue (RabbitMQ / SQS) · Every curriculum

Built with Arqly
Every scene in Build a Message Queue (RabbitMQ / SQS) builds on the one before it.All 14 Build a Message Queue (RabbitMQ / SQS) scenes