I am wondering if it is preferable to post events rather than throw exceptions from aggregates. Let's say I have a domain in which there is a requirement that students of a certain level can sign up for a sport. If I call EnrollForSports on a student who does not meet the criteria, should the unit exclude or post the event, especially if other agents or process managers are interested in the result of the process?
If an event is published, does this not mean that to handle the event, when we replay, an appropriate internal event handler will be needed, even if the event does not change the state of the aggregate?
If an exception is selected, how will the other parties be notified? Can a command handler catch an exception and then raise an event? Can events be raised from command handlers?
source share