Specify List of Servers using Core
38.5.1.2. Specifying List of Servers using the Core API If you're using the core API you can also specify the list of servers directly when creating the ClientSessionFactory instance. Here's an example: List > serverList = new ArrayList>(); serverList.add(new Pair(liveTC0, backupTC0)); serverList.add(new Pair(liveTC1, backupTC1)); serverList.add(new Pair(liveTC2, backupTC2)); ClientSessionFactory factory = HornetQClient.createClientSessionFactory(serverList); ClientSession sesison1 = factory.createClientSession(...); ClientSession session2 = factory.createClientSession(...); In the above snippet we create a list of pairs of TransportConfiguration objects. Each TransportConfiguration object contains knowledge of how to make a connection to a specific server. For more information on this, please see Chapter 16, Configuring the Transport. A ClientSessionFactoryImpl instance is then created passing the list of servers in the constructor. Any sessions subsequently created by this factory will create sessions according to the client connection load balancing policy applied to that list of servers.