Commands vs events
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
name messages correctly.
Planned topics
- A command asks for something to be done:
ReserveStock. Imperative name, one intended receiver, can be rejected. - An event states a fact that happened:
StockReserved. Past tense, any number of listeners, cannot be rejected. - The publisher of an event does not know or care who listens.
- A "command in disguise" like
OrderPlacedPleaseReserveStockcouples sender to receiver. - Name events after business facts, not technical changes (
OrderPlaced, notOrdersRowInserted).
Draft outline details
Demonstration
a table of five Shop messages classified as command or event.
Check your understanding
Is PaymentAuthorized a command or an event?
Show answer
An event; it is past tense.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.