You can set route-when-no-consumers to true, then it will round robin irrespective of the number of consumers on each node.
But I'd say the real issue here is your architecture is broken. Maintaining a pool of consumers and doing synchronous receives on them is ugly.
This will be slow, and will also require you to turn off consumer buffering. Sounds like the kind of thing Spring does
Hi Tim, and thanks for the response.
Maybe I didn't explain my use case well enough. The whole purpose of this is not to complete tasks as quickly as possible. These are actual human tasks being handed out via hornetq. Tasks are loaded into the queue and then as users come into the system they grab a task off the queue and complete it.
Like I said, I'm open to other suggestions. Even if the suggestion is that HornetQ is not a good fit for this scenario. We like using HornetQ though because it scales well and performs really great. We also can't have these tasks getting lost which is why we want to use HornetQ's durable messages.
The advice to set route-when-no-consumers to true is not a viable solution since I'm not looking for round robin. If Appserver1 has 3 times the number of active users as Appserver2, then round robin will not keep Appserver2's queue from backing up and starving Appserver1.
Again, what I am looking for is a way to redistribute the messages based on queue size to ensure there are always tasks on each node. We have no way of controlling how fast people work either, so we may have a bunch of fast workers on one node and slow workers on another.
I can't imagine I'm the only one out there with this type of usage scenario (one node completes faster than another) even if it does not involve human task completion. It seems that HornetQ would benefit from having some more robust message redistribution options other than simply, if there are no consumers left on a node then we will redistribute. Especially when the best practices for performance reasons is to not open and close consumers for each message but rather keep them connected permanently.