I would like to implement CQRS and ES using Axon framework
I've got a pretty complex HTML form which represents recruitment process with six steps.
ES would be helpful to generate historical statistics for selected dates and track changes in form.
Admin can always perform several operations:
- assign person responsible for each step
- provide notes for each step
- accept or reject candidate on every step
- turn on/off SMS or email notifications
- assign tags
Form update (difference only) is sent from UI application to backend.
Assuming I want to make changes only for servers side application, question is what should be a Command and what should be an Event, I consider three options:
- Form patch is a Command which generates
Form Update Event
- Drawback of this solution is that each event handler needs to check if changes in form refers to this handler ex. if email about rejection should be sent
- Form patch is a Command which generates several Events ex:.
Interviewer Assigned, Notifications Turned Off
,Rejected on technical interview
- Drawback of this solution is that some events could be generated and other will not because of breaking constraints ex:
Notifications Turned Off
will succeed butInterviewer Assigned
will fail due to assigning unauthorized user. Maybe I should check all constraints before commands generation ?
- Drawback of this solution is that some events could be generated and other will not because of breaking constraints ex:
- Form patch is converted to several Commands ex:
Assign Interviewer
,Turn Off Notifications
and each command generates event ex:Interviewer Assigned, Notifications Turned Off
- Drawback of this solution is that some commands can fail ex:
Assign Interviewer
can fail due to assigning unauthorized user. This will end up with inconsistent state because some events would be stored in repository, some will not. Maybe I should check all constraints before commands generation ?
- Drawback of this solution is that some commands can fail ex: