I can think of two places where to put the domain logic in an event sourced system either one has a drawback.
- In an event handler of the Aggregate, called locally after creating the event. (That's what I saw in most examples though most of them have very simplistic logic)
Issue: The event stored in the event store and published to subscribers does not include this processed data and therefore on the projection the same logic has to be applied to the event. - Before creating the event. Now the processed data can be stored in the event and the projection doesn't have to know anything about business logic. (I haven't seen this method in examples)
Issue: In this case though the event only includes the processed data which possibly can lead to information loss.
Even worse: I also loose the possibility to correct wrong business logic by replaying the events because the event data already has been calculated.
Example: Calculating a metric from some data.
Either I have to calculate the metric twice (one time in the domain model, one time in the projection)
or I have to calculate it before sending the event and including it there.