In our current project, for some operations we send messages to Database like COMPLETED-Order,STARTED-Request, REJECTED-Order with related information like OrderId.... All the messages correspond a Command class that implements Command Pattern.
interface ICommand
{
void Execute();
}
public class RequestStartedCommand:ICommand
{
public void Execute()
{
//do the related work.....
}
}
//other commands...
A windows service consumes this messages then converts them above commands and executes commands by a ThreadPool.
But some commands needed to be executed before other commands like OrderID=23's COMPLETED-Order command must be executed before same order's REJECTED-Order command. How can I do this or Which strategy should I follow? Any examples or documentation would be usefull.