Our application sometimes generates large bursts of commands. These all execute without trouble, but any smaller, unrelated requests that arrive while the application is handling those commands end up getting queued after the bursts and can thus take abnormally long to finish. In most cases that’s not a problem but there are a few commands that we want to finish in a reasonable amount of time. It so happens that those latency-sensitive commands are all aggregate creation commands.
Ideally it’d be great if there were some notion of command priority such that I could set the bursty commands to low priority and they would have only minimal impact on latency of other work.
But that’s probably a pretty deep change with lots of edge cases to worry about, so I’m wondering if instead I can add a second command bus to the application to handle the latency-sensitive synchronous aggregate creation commands. Since they are all aggregate creation commands, there’s no chance of one of them conflicting with a command for the same aggregate on the main command bus, which seems to me like it’d be the major possible source of problems with a two-bus setup. And it also seems like the new one could be a SimpleCommandBus so as not to bottleneck on any JGroups message queues (our main bus is a DistributedCommandBus).
What gotchas am I not thinking about, if any? Is there another, better way to solve the starvation problem?