Reputation: 726
At my system when a new transaction added to the system, that request has the following information
Also if the transaction will not be paid by installments the analysis data must get updated (clear-in of current month etc).
So when a new transaction submitted by the user the following must be done
2) Add the new transaction into the database
and if there are installments
3) add the installments into the database
else
So the solution to this is at my controller AddnewTransactionController
extract the request into two separate commands AddNewClientCommand
AddNewTransactionCommand
and invoke the associated command handlers AddNewClientCommandHadler
AddNewTransactionCommandHandler
.
Also the AddNewTransactionCommandHandler
will have domain services injected like UpdateanalysisData
.
Does the above consider a good solution from architectural point of view?
Upvotes: 0
Views: 56
Reputation: 57257
I would normally expect to that approach implemented as a process, rather than as a collection of commands.
The client commits to an order, which is to say some remote entity outside the boundary of our solution offers to us the opportunity to earn some business value. So the immediate priority is to capture that opportunity. So you write that opportunity to your durable store, and publish a domain event.
In response to the domain event, a bunch of other commands can now be fired (extracting the data that they need from either the domain event, or the representation of the opportunity in the store).
Upvotes: 1