We have a web based platform that a user enters quite a bit of transactional data. Was curious about what others are doing when it comes to Asp.Net Controllers - do people process the command in the controller and then use NServiceBus to raise events or are you dropping the command immediately in the queue and letting it be handled by NServiceBus
We currently queue the command and use NServiceBus and then use Signalr to update the front end.
But I think we could have a better user experience if we processed the command synchronously (for most situations) and then queued events from there.
I think there’s some scenarios (typically anything involving a process manager) where queueing the commands makes sense but that would be the exception, not the rule.
Was thinking our Command Api Controllers would essentially give one of the following responses:
- Successful
- Unsuccessful (various flavours here)
- Queued
Would provide a convention that the front end could then handle appropriately.
The challenge becomes what if it fails… The most concerning one being that we use in memory domain event handlers and have logic to handle retries. My assumption would be to use Mediatr and add retry behavior to it.
All of this sounds good but I feel like it might make for a cumbersome dev experience or I might be over complicating it…
Curious what others are doing?