I have a CQRS .NET Core service that currently has a single endpoint for each command. Sometimes a collection of commands makes up a single action in the system (e.g. create an assessment) and 3 or so commands have to be executed synchronously once the previous command has commited data to the db (this is because of the legacy database design).
At the moment this is handled by the client where each command fires after the it's previous dependent one has completed (using promises).
It's worth noting that these commands are also executed individually at times and if they were combined in to a single command it would end up being massive and very hard to test.
What I want to do is create a single endpoint that manages operations like our create assessment one, which has to execute the following commands one after the other:
- UserCreated
- AssessmentCreated
- AssessmentRegisteredToClient
I've have been going down the route of using a MassTransit saga/state machine/process manager but the more I work on it (and the more my understanding improves) the more I think it seems like overkill and not the right approach (as these are commands and not events and all within a single bounded context).
Does a process manager seem like the right fit and if so is the MassTransit state machine implementation the way to go or should I look at other sources? Or should I just simply create an endpoint that fires each command one at a time (i.e. have this synchronous code in the ASP controller)?