liveBook · Manning

Command

As explained in Apache Kafka in Action

A command is a message that requests another system to perform a specific action.

A command is a message that instructs another system to perform a specific action. In an online-store workflow, a promotion-monitoring service can send commands to an independent notification service, which may serve many other services. Systems commonly combine commands with states, deltas, and events. section 3.2.1 section 3.3

Customer-notification commands

After a promotion starts, a producer can publish one command per customer: {"command":"notify_customer","customer_id":123456,"message":"The promotion for Coke Zero started. It's now 1.99"}. Each message requests the notification service to perform the same action for a different customer. section 3.2.1

# One message per line
{"command": "notify_customer", "customer_id": 123456,
"message": "The promotion for Coke Zero started. It's now 1.99"}
{"command": "notify_customer", "customer_id": 123457,
"message": "The promotion for Coke Zero started. It's now 1.99"}
{"command": "notify_customer", "customer_id": 123458,
"message": "The promotion for Coke Zero started. It's now 1.99"}

Browse the line-oriented command messages used to request customer notifications. section 3.2.1

In Kafka, commands are exchanged as messages in topics. Topic partitions support distribution and performance, while schemas help maintain consistent command data. section 3.3

How Apache Kafka in Action covers it

How deep it goes
Defines commands, contrasts them with other message types, and demonstrates a notification payload without detailing command processing internals.
Examples
Uses promotion notifications, customer identifiers, and notify_customer payloads as concrete command examples.
What you can do after
Apply command messages to request actions from independent services through Kafka topics.
How it connects
Connects commands to events, Kafka topics, partitions, message schemas, and distributed services.

Also explained in

Compare how 5 books explain command →

Related concepts

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