March 2025
Intermediate to advanced
202 pages
4h 45m
English
So far, you’ve created an imperative calculator and then made it a bit more general-purpose by introducing the concept of a command. The command is an instruction to do some work, and the result in the previous example was the result of the actual work.
In the world of event sourcing, this isn’t actually how or where work gets done. Remember that events are immutable, and state is only derived from a sequence of events. This means that in the previous code listing we cheated and skipped a step: we combined the role of command and event handler into one.
Let’s split out those roles now. The purpose of a command handler is essentially to convert a command into one or more events. State is produced through ...
Read now
Unlock full access