Events vs Messages vs Commands
You'll learn how to distinguish between three fundamental communication patterns in event-driven systems: events, messages, and commands.
What's the Difference?
While all three involve sending information between components, they have distinct meanings and purposes that shape how systems communicate:
Events: Facts About the Past
Events represent something that has already happened. They're immutable historical facts, stated in past tense: "Order Placed," "Payment Processed," "User Registered." Events don't request anything—they announce reality. Multiple consumers can react to an event, but the event itself doesn't care who listens or what they do.
Analogy: Like a news broadcast announcing "The store opened at 9 AM." It's a fact. Whether anyone listens or acts on it doesn't change what happened.
Commands: Requests for Action
Commands are imperative instructions telling a specific component to do something: "Place Order," "Process Payment," "Register User." Written in present tense or imperative form, commands expect a single recipient to handle them. They can be rejected if the action isn't possible.
Analogy: Like telling your assistant "Please book this meeting." You're directing someone specific to take action, and they can say "Sorry, that time slot is taken."
Messages: General Communication
Messages are the umbrella term for any data sent between components. Both events and commands are types of messages, but "message" itself is generic—it's the envelope, not the intent. When discussing messaging systems, you're often talking about the transport mechanism, not the semantic meaning.
Why It Matters
Understanding these distinctions helps you design clear communication patterns. Events enable loose coupling (publishers don't know subscribers), while commands create directed workflows. Mixing them up leads to confused architectures where you're not sure if something can be ignored or must be handled.
Key Takeaway: Events announce past facts to anyone listening, commands direct specific actions to specific handlers, and messages are the general transport mechanism for both.