I figured this out. My cluster has two nodes 5074 and 15446.
The ClusteredConnectionFactory LoadBalancingFactory is set to the RoundRobinLoadBalancingFactory. The RoundRobinLoadBalancingPolicy walks a list of ConnectionFactoryDelegates which is sequentially ordered. Each stand alone client application gets one connection from the list. This list is ordered the same on both nodes. The result, connection always start on the same node.
Question, is the list of delegates the same order on every node in the cluster if the cluster contained 5 nodes, 10 nodes?
Possible solutions anyone?
You haven't explained why it is a problem for you to have both connections created on the same node.
If you use a connection factory with loadBalancing = true, then it will round robin the creation of the connections on the two nodes.
This gives a good distribution of connections when you have many connections.
I can only assume from your post that you actually want your connections always created on the same node given a specific connection factory??
In which case deploy a cf with supportsLoadBalancing = false;
See the userguide for more details:
i can see two possible issues, first if I start 20 standalone clients (each with one connection), they will all create connections to the same node, rather than round robin to multiple nodes, if the node fails, all 20 would try to fail over at the same time.
The second issue has to do with a known problem, http://jira.jboss.com/jira/browse/JBMESSAGING-972. I find, under load, I end up with a non-zero message count on one node with a consumer count of zero on the same node. These messages sit on the queue indefinitely, unless I start a client locally using ConnectionFactory which creates a connection to the same node.