Dispatcher - When sending something to an ES, use its dispatcher
Command - Dispatchable message - When sent to the dispatcher, it will be sent to the correct ES.
Dispatcher - When sending something to an ES, use its dispatcher
Command - Dispatchable message - When sent to the dispatcher, it will be sent to the correct ES.
Event - Represents a change of state for an ES
State is immutable.
Represents the full state of the entity. based on its state it can accept or reject an event.
Has with method transition(event) - if ok, it returns new state. If not, an error is thrown.
Can be used to try an event (since it is mutable)
DurableMessage: method of sending a message which with retry-mechanism until confirm() is called.
GeneralAggregate pseudocode:
for each received cmd:
convert it to event
try the event (by calling state.transition() )
if it failed: maybe do something
if it works:
persist event
generate and send DurableMessages
change our current state (by calling state.transition() and keeping the result )
Dispatcher - When sending something to an ES, use its dispatcher Command - Dispatchable message - When sent to the dispatcher, it will be sent to the correct ES.
Event - Represents a change of state for an ES
State is immutable. Represents the full state of the entity. based on its state it can accept or reject an event. Has with method transition(event) - if ok, it returns new state. If not, an error is thrown.
Can be used to try an event (since it is mutable)
DurableMessage: method of sending a message which with retry-mechanism until confirm() is called.
GeneralAggregate pseudocode:
for each received cmd: convert it to event try the event (by calling state.transition() ) if it failed: maybe do something if it works: persist event generate and send DurableMessages change our current state (by calling state.transition() and keeping the result )
Superclass/trait representing your events
The type representing your state