liveBook · Manning

Queue

As explained in Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

A RabbitMQ queue is a buffer that stores messages until consumers retrieve them.

A RabbitMQ queue buffers messages between microservices. Senders publish messages to a named queue, while receivers pull them when ready, avoiding a direct sender-to-receiver connection. section 5.6.2 section 5.8

This pull-based arrangement gives consumers control when they are overloaded or temporarily unable to process messages. A queue can also distribute each message to one recipient in a pool, so a job is handled once. section 5.8.2 section 5.8.6

A practical RabbitMQ queue workflow includes:

  • Connect to RabbitMQ using AMQP and the amqplib library. section 5.8.2
  • Assert the named queue, which checks for its existence and creates it only when necessary. section 5.8.6
  • Publish a message by pushing it into the queue, or consume messages by pulling them from it. section 5.8.2
  • Acknowledge a message after successful processing so an unacknowledged message can be handled again if a consumer fails. section 5.8.6 section 5.8.8

Viewed-message queue

A video-streaming service publishes a JSON message containing a video path to the viewed queue. The history service consumes it, parses the payload, records the view, and acknowledges the message. RabbitMQ treats the payload as binary data, so JSON serialization and parsing are handled by the application. section 5.8.6

Figure 5.11 A message is sent by pushing it into a RabbitMQ queue.

Shows the queue as the destination where a sender pushes an indirect message before a consumer retrieves it. section 5.8.2

How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it

How deep it goes
Explains queue addressing, assertion, publishing, consuming, acknowledgment, payload parsing, and failure recovery.
Examples
Uses a viewed queue, video-streaming publisher, history consumer, JSON payload, and Docker Compose project.
What it assumes
Assumes microservices and indirect messaging, while introducing RabbitMQ queues, AMQP access, queue assertion, and acknowledgments.
What you can do after
Builds a one-to-one message flow that publishes, consumes, parses, persists, and acknowledges RabbitMQ messages.
How it connects
Connects RabbitMQ queues with microservices, indirect messaging, message exchanges, AMQP, and acknowledgment.

Also explained in

Compare how 24 books explain queue →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.