Queues & streams
medium 30 minA message queue stores work between the program that asks for it and the program that does it.
Remember it
The few things worth knowing cold, and how to make them stick.
Memory hook
QUEUE: Quality of delivery, Uncouple, Enable async work, Use buffering, Ensure order within a scope.
A washing-up rack. Put the plate down and go. A card keeps the place of a plate in the sink, and the burnt one goes into the red box.

Cheat sheet
- Guarantees
- at most, at least, exactly-once effect
- Receive
- hides, does not delete
- Acknowledge
- after the work
- Main models
- point to point, publish and subscribe
- Workers
- rate x time / use
- SQS retention
- 4 days, 14 at most
- Kafka retention
- 7 days by default
- Group ceiling
- number of partitions
- Alert
- age of the oldest message
Spot it when you see
- Work that can finish after the answer.
- Bursts with quiet times in between.
- One event with several readers.
- A slow or unreliable service behind you.
Tricks that stick
- Producer, queue, consumer: three speeds.
- Silence brings it back.
- Queue forgets, log remembers.
- Order by key, not order by wish.
Do not forget
- Acknowledging before the work.
- No dead letter queue, or one that nobody watches.
- Large files inside messages.
- A visibility timeout shorter than the work.
- Using a queue to hide a lasting lack of capacity.