Here is my question:
I have a libs component that encapsulate every domain aspect of my application. On another component, a monolithic app (with query handlers inside) that updates views and expose API’s.
My domain doesn’t have logic to handle with a specific external API (Identity), but need to store some information regarding events from the external API.
Below I’ll add my Handler (inside query side) and the aggregate that it deals with (on domain side).
I have achieved my goal, but the fact that I’m sending a command from a QueryHandler makes me think that the design is wrong.
The other bonus (that I forgot) is that it encapsulates your logic into the aggregate. This keeps you logic more centralized vs spread out across your application.
The main reason that I have not added to my aggregate is because the command will be handled only after a API integration.
I do not want to add a port inside my aggregate. My command will be handled only if my Identity Server creates my user (for example).