I am using JConsole to check/verify that the connections have been established in a load balanced way to all the 3 HornetQ servers.
I noticed that when i am debugging through the loop that creates multiple connections, the connections were load balanced.
So, when I introduced a Thread.sleep(1000) in the loop where I was creating the connections, the connections were load balanced across the hornetQ servers in the cluster.
Has anybody noticed this? Any inputs on this?
Probably you haven't waited long enough for discovery information to reach the client.
Each server broadcasts its whereabouts every x milliseconds, when the client gets a broadcast from a server it will know about that server.
Until it gets a broadcast from a server it won't know it exists.
The broadcast period is configurable in the broad cast group config (broadcast-period).
Also there is a discovery-initial-wait setting on the session factory.
See user manual for more info.
Oh! That might explain this. Thanks Tim.
I will look into the "discovery-initial-wait" and the broadcast group configuration.
I think this is related to the defect in RoundRobin implementation.
I tested with a local fix on RoundRobinConnectionLoadBalancingPolicy.java and the load balancing worked correctly.