2

This question is similar to: Does exist application event term in DDD? , but I don't know how to apply the explanations given there to my specific issue.

I have a SearchFilmUseCase and I want to raise an event FilmSearchedEvent once it finishes its execution. Currently, the application layer is raising the event. The only manner in which I could raise this event from the Domain is in the FilmRepository. However, the repository is just an interface, so I can't raise any event there.

I think that raising the event at the application layer is not correct. How can I approach this situation?

vicaba
  • 2,676
  • 1
  • 22
  • 40

2 Answers2

2

One solution could be to create a domain service to perform the search and raise the event.

choquero70
  • 3,332
  • 2
  • 24
  • 40
1

All Domain Events must be raised from domain layer. The best place is an aggregate root where the action should be really done. The aggregate root could contain all the domain events that have been raised, and in the application layer you could get them and publish them to the event bus.

Albert
  • 40
  • 8