HappYness-Project / Happy-EventSourcing

Event sourcing
10 stars 1 forks source link

Only Domain events should be stored in event store. #109

Open hyunbin7303 opened 11 months ago

hyunbin7303 commented 11 months ago

Event handlers will likely be creating a new command that will result in the related aggregate creating its own domain event that will be saved in its stream.

The domain may react to the integration event and produce multiple domain events

Other case.

Service 'B' event handler who subscribed to the event published by Service 'A' received the event.
Service 'B' event handler call the appropriate domain aggregate method
Service 'B' aggregate produce domain events and save them in its stream in the Service 'B' eventstore

the events belong to a stream for a single aggregate. So even if service A emits a domain event that's been saved to an aggregates stream and service A has an event handler listening for that event, it would still be very inappropriate for service A to save that domain event into the stream of another aggregate.