Video in progress

What's the difference between an event and a command message?

Command / Event — Name: imperative: ReserveStock / past tense: StockReserved; Receiver: one, specific / unknown, zero or many; Can it be rejected: yes ("out of stock") / no, it's a fact that already happened; Coupling: the sender knows the receiver / the sender knows nobody

📖 Answer

Command Event
Name imperative: ReserveStock past tense: StockReserved
Receiver one, specific unknown, zero or many
Can it be rejected yes ("out of stock") no, it's a fact that already happened
Coupling the sender knows the receiver the sender knows nobody

In practice the difference affects the design. If order-service emits an OrderPlaced event, tomorrow loyalty-service can subscribe to it too, without changing order. That reduces coupling.

But doing everything with events is also a mistake. "Charge the money" is really a command: someone specific has to do it and a result has to come back. If you hide it in an OrderPlaced event, the process logic gets scattered across several services and it becomes hard to answer "why was the money charged?".

What to send in the event payload is a decision of its own: only the ID ("order 42 changed") or the full state. The full state saves the consumer a callback, but the message gets bigger.