I'm creating a webservice+servicebus project where user can do something like
public void ExecuteLongProcess(DateTime fromDate,string aggregateId){}
This method immediately returns but send over the bus a request for the operation.
My problems starts when multiple user ask for the long process over the same aggregateId when another one is already running.
The solution i'm thinking about is a Task that runs continuosly and look in a Queue<LongProcessTask>
for a operation that must be executed so I run only one process a time or a future implementation will be multiple process if different aggregateId.
This way I don't overlap long running process over the same aggregate.
Other ideas?
I have created a TaskRunner that instantiate some continuous running Task (number depending on processor cores) that look in a concurrent queue and run each operation pending. TaskRunner get from Windsor the handler for each operation type in order to leave the processing of each operation in a class aside.