Using a request model in a command handler / domain services

Should I use a query model to combine / verify certain aggregate information, for example, in a domain service? I have seen this in many examples. But what if request data is distributed asynchronously as a result of a domain event?

Example: a message board with a user aggregate and a message aggregate (divided by a smaller trx border). When a user is flagged-deleted, all his messages should also be marked as deleted. This will be done by handling the UserMarkedDeletedEvent in the MessageEventHandler service. Now this service should run DeleteMessageCommands for each message with a specific user. To find messages, a query is required. I guess this should be done on a read model, which might be deprecated due to asynchronous updates ... (I suppose the only option is a read / request model in the case of Event Sourcing)

+4
source share
1 answer

. , .

, . , , .

, . .

:

foo - - ​​( ), . , , - foos - . , , , , .

+1

Source: https://habr.com/ru/post/1606032/


All Articles