I have an application service that performs inventory issues ( InventoryService ) directly and I have an application service that performs the sales receipt ( SalesService
strong>). But in the workflow of receiving a sale ( SalesService ) I need to do exits from the stock ( EstoqueService ).Should I call InventoryService to perform this function from within SalesService ?
Or should the client (in my case the services view) call SalesService to receive and then InventoryService to perform the exit? So the client would have much knowledge of the workflow.
I thought of creating another service that would encapsulate this workflow so the client just needs to call the new service.
Is this a case of communication between Bounded Contexts? In my case I'm not making a distinction between contexts.
UPDATE
In Vaughn Vernon's book he refers to a Domain Event Handler that calls another Application Service that modifies a second aggregate.
Maybe this is the best way, as long as I figure out how to create a new transaction instead of creating a nested transaction. Or run the handlers after finishing the first transaction as I read in this article link