How it works · 20 of 38 Core

What are message queues and event-driven systems?

Pass the work on, don't wait

Queues & events: A queue sits between a program that creates work and the programs that do it: the sender drops a message and moves on, workers take messages at their own pace, and a message a worker drops comes back for another; because it can come back, it may be delivered more than once, so the work must be safe to repeat.

Loading the animation…

Say it like this A queue lets one program hand work to others without waiting for them; workers take messages at their own pace and a dropped message comes back, so it can arrive twice and every worker must make a repeat harmless.

Under the hood — for builders
The source's own words
Amazon SQS standard queues: "more than one copy of a message might be delivered, and messages may occasionally arrive out of order."
Producer, consumer
Producer: sends the message. Consumer (worker): receives, handles, then deletes it.
Idempotent
Safe to run twice with the same result: record each order number handled, skip repeats.
SQS limits, to scale
Visibility timeout: how long a received message stays hidden from other workers:
Watch out
Set the visibility timeout above your slowest job, or a second worker picks up the same message.
Dead-letter queue
Where messages that keep failing go, instead of retrying forever. Messages max out at 1 MiB.
Sources
Amazon SQS Developer Guide: "Amazon SQS standard queues", "Visibility timeout", "Amazon SQS message quotas" (read November 2026).

What happens in the queues & events animation, step by step?

  1. On sale day, orders pour in. If checkout calls the packing service and waits, every customer waits for packing, and when packing is down, so is checkout.
  2. Put a queue in between: checkout clips each order to the rail and answers the customer at once. Packers take tickets at their own pace; neither waits for the other.
  3. Your turn: the sale starts. Drag the number of packers and watch the rail. A queue holds a message for 4 days by default (Amazon SQS), so a slow hour is a backlog, not a lost order.
  4. If a packer drops a ticket mid-job, nothing is lost: after the visibility timeout (30 seconds by default in Amazon SQS), the ticket reappears and another packer takes it.
  5. The catch: the first packer had already packed it, so order 41 ships twice. Standard queues deliver every message at least once, not exactly once, so each worker checks 'done already?' before acting.
  6. One 'order placed' event can feed packing, email and loyalty points at once: that's event-driven. Finance still totals the day at midnight. Each event as it lands, or one nightly batch? Next: batch vs streaming.

What everyday example explains queues & events?

The order rail in a busy kitchen. The waiter clips a ticket and goes back to the tables; cooks take tickets as they free up. If a cook walks off with a ticket and never comes back, it is put back on the rail, which is how the same dish can be made twice.

Why should a team care about queues & events?

Put a queue between a fast front end and slow or flaky work (payments, emails, video encoding), set the visibility timeout above your slowest job, make every handler idempotent (an order id it has already handled is skipped), and watch queue depth as the signal to add workers.