Reading CQRS from a domain model?

Is it completely prohibited (or simply inappropriate) for the domain model in CQRS to return state to the client? for example, if there is updated current information in the domain model. I am thinking of a team that triggers events and changes in the domain model and returns information to the client.

Alternatives seem like this:

  • the client determines the updated state itself (code duplication), which should hopefully correspond to the final update of the reading model,

  • the client is waiting for the reading model to be updated (possible consistency) and somehow knows when to read from there to update its state, or

  • the entire command is executed synchronously, and the reading model somehow transfers information to the client, for example. with some kind of network socket.

I assume the latter relates to the desire to create reactive applications that include CQRS. The concept of polling clients for updates seems unsatisfactory (and similarly for polling read models for updates from a domain model).

+4
source share
1 answer

Is it completely forbidden (or simply inappropriate) for a domain model in CQRS to return state to a client?

Assuming you mean DDD / CQRS, I think the dogmatic answer is "so inappropriate that it might be forbidden." Sure, this will not be taken for granted, but your architecture has taken a step down a very slippery slope, which (at its bottom) is a large ball of mud.

, , .

, , , "info", , , !

" -", " ", " ". , , , "" , .

:

Application Layer - "where" , - . (, , POST- Command.) , , , .

, ( ), , websocket... .

+3

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


All Articles