liveBook · Manning

Queue

As explained in Learn Docker in a Month of Lunches, Second Edition

A message queue technology is software that provides queues and related mechanisms for storing and delivering messages between application components.

A message queue lets application components communicate without connecting directly. Producers send messages to the queue, which delivers them to one or more recipients. This decoupling supports faster communication, improved scalability, and new features without requiring downtime. section 21.0

Clients connect to a queue to publish or receive messages. Queue protocols are optimized to transmit request bytes and return acknowledgments quickly, while avoiding complex message processing. This allows high message throughput and shorter-lived connections than direct database requests. section 21.1

Choose the queue pattern according to the workflow:

  • Use Redis channels when publishers broadcast messages and each subscriber should receive a copy. section 21.1
  • Use NATS subjects to identify message types, such as events.todo.newitem, between containerized services. section 21.2
  • Move work such as saving a to-do item behind a queue when direct database connections could become a scalability limit. section 21.2
  • Plan subscribers as part of the feature: publishing without a subscriber can leave expected application behavior missing. section 21.2

Run a local message flow

Create a Docker network, start Redis, publish “ping” on channel21, and attach a subscriber. The subscriber displays messages as they arrive. For an application workflow, start NATS with Docker Compose, publish a new-item event from the web service, then run a subscriber on events.todo.newitem to verify delivery.

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains asynchronous delivery, acknowledgments, Docker setup, publish-subscribe commands, and application integration.
Examples
Uses Redis ping messages, channel subscriptions, NATS subjects, and a to-do application that publishes new-item events.
What you can do after
Operate/configure Redis and NATS containers, publish messages, subscribe to channels or subjects, and verify delivery.
How it connects
Connects asynchronous messaging with Docker, Redis, NATS, publish-subscribe systems, REST APIs, databases, and scalability.

Also explained in

Compare how 24 books explain queue →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.