Storing State as Events
Up to this point, this concept of commands and events may be familiar. You may have already used technology such as Apache Kafka[21] to have components communicate via events. We’re going to take it further though.
You may receive a command like PetPuppies, a command that should never be rejected. When a command is processed, the output is one or more events, such as PuppiesPet. If we wanted to know whether or not the puppies have been pet, how could we tell? Take a moment and think about it…
All we’d have to look for is that event. Instead of treating the messages as transient notifications, discarding them when we’re done, we save them. Then we can constitute and reconstitute current state or state at any point in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access