liveBook · Manning

Message queue

As explained in Fast by Default

A message queue is an intermediary that buffers messages between producers and consumers so work can be processed asynchronously.

Message queuing moves work off the request-response critical path. Producers submit work for consumers to handle asynchronously, so each can operate at its own pace instead of forcing a user-facing request to wait for every downstream system. section 5.3.5

Use a queue when an operation does not need an immediate response. After an e-commerce purchase, payment validation and order confirmation remain on the critical path; inventory updates, warehouse notifications, email, and analytics can run afterward. This can return confirmation in 200ms rather than delaying the user for several seconds. section 5.3.5 section 5.6

Choose the messaging model by how consumers need to access messages:

  • Use a traditional queue such as RabbitMQ for task distribution: one consumer processes an enqueued job and the message is removed. Suitable jobs include image processing, report generation, and notification delivery. section 5.3.5
  • Use an event-streaming platform such as Kafka when multiple consumers must independently read the same event or when replay is needed. Kafka retains messages in an append-only log, allowing consumers to process at their own pace or replay events after failures. section 5.3.5

Separate confirmation from downstream work

A purchase flow should confirm payment and the order before responding. Queue inventory synchronization, warehouse notification, email delivery, and analytics events so slow downstream systems do not extend the user-visible transaction. section 5.3.5

Message queues are an architectural performance choice, not a late code-level optimization. They reduce user-facing latency by separating critical work from background processing while avoiding tight coupling between producing and consuming services. section 5.0 section 5.6

How Fast by Default covers it

How deep it goes
Explains critical-path removal and contrasts task queues with durable, replayable event streams.
Examples
Uses purchase confirmation, emails, inventory updates, warehouses, analytics, image processing, and report generation.
What you can do after
Apply it via RabbitMQ for task distribution or Kafka for independent consumers and event replay.
How it connects
Connects message queues to request-response communication, event-driven patterns, critical paths, Kafka, and RabbitMQ.

Also explained in

Compare how 3 books explain message queue →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast by Default. The section links point to the parts of the book it draws on.