AlgoViz

Queues & streams

medium 30 min

A message queue stores work between the program that asks for it and the program that does it.

Where it shows up

The same pattern appears across everyday software.

  • Payment and checkout pipelines

    Placing an order emits an `OrderPlaced` event. Fraud, stock and receipt services each run as their own consumer group and read the same events without disturbing one another.

  • Fleet and vehicle tracking

    Positions are partitioned by driver or vehicle id. All positions of one vehicle then reach the consumer that computes distance in the order in which they were written.

  • Change data capture

    Debezium reads the change log of a database and sends the changes to topics, so that caches, search indexes and data warehouses can follow. See [change data capture](/learn/system-design/change-data-capture).

  • Image and video processing

    An upload is stored, a small job with its link is queued, and a pool of workers makes the sizes. The pool grows with the backlog.

  • Email and notifications

    The sign-up request ends when the job is stored. A provider that is slow for ten minutes means late mail, not failed sign-ups.

  • Serverless work

    A managed queue such as SQS starts functions as messages arrive, retries on failure, and moves messages to a dead letter queue after a set number of receives.