add_item is not an event, rather a command/ request that is yet to be validated. item_added is the event = a fact that was 'allowed to happen' by the system. Keeping commands in a persistent store is a matter of choice…
TLDR; You evaluate your preconditions and invariants before the event is published, using the current state of the aggregate. Here's how that looks like in a DDD world: * An aggregate is responsible for encapsulating…
add_item is not an event, rather a command/ request that is yet to be validated. item_added is the event = a fact that was 'allowed to happen' by the system. Keeping commands in a persistent store is a matter of choice…
TLDR; You evaluate your preconditions and invariants before the event is published, using the current state of the aggregate. Here's how that looks like in a DDD world: * An aggregate is responsible for encapsulating…