liveBook · Manning

Producer

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

A publisher is a messaging component that sends messages to a queue or channel.

A producer, also called a publisher, is a messaging component that sends messages to a queue or channel. It does not need to know which subscribers are listening; the message queue separates producers from receiving components. section 21.1

In Redis, a producer publishes to a named channel. Any subscriber using the same channel receives a copy of each message. Producers and subscribers can run independently, so publishing can continue before a subscriber starts listening. section 21.1

Publish messages with Redis in Docker

Create a Redis network and run a background producer that publishes "ping" to channel21 50 times, waiting five seconds between messages. Then run a Redis CLI subscriber on channel21 to observe the messages. The producer logs response codes, while the subscriber prints received message details. section 21.1

# run the Redis client in the background to publish messages:
docker run -d --name publisher --network ch21 `
 diamol/redis-cli:2e -r 50 -i 5 PUBLISH channel21 ping
# check the logs to see messages are being sent:
docker logs publisher

Use the runnable Docker command to start a Redis producer and verify its publishing logs. section 21.1

Producers can publish fixed-structure events such as a new-item event. Multiple components can publish the same event, while multiple message handlers subscribe to it, allowing features such as auditing and saving to evolve independently. section 21.4

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

How deep it goes
Explains terminology, channels, Docker commands, delivery behavior, and multiple-publisher patterns without detailing message-queue internals.
Examples
Demonstrates Redis CLI publishing, Docker containers, the channel21 channel, ping messages, and new-item events from a REST API.
What it assumes
Assumes basic Docker command use while introducing messaging roles, channels, subscribers, and asynchronous communication.
What you can do after
Operate/configure a Redis producer with Docker and recognize how published events support independently deployed message handlers.
How it connects
Connects producers with message queues, channels, subscribers, asynchronous messaging, message handlers, and REST APIs.

Also explained in

Compare how 8 books explain producer →

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.