Check out the "symmetric-cluster" example that ships with HornetQ. You just need to instantiate one extra class to account for the one additional layer of abstraction we needed to add to integrate JGroups. Here's a relevant snippet from org.hornetq.jms.example.SymmetricClusterExample:
UDPBroadcastGroupConfiguration udpCfg = new UDPBroadcastGroupConfiguration("220.127.116.11", 9876, null, -1); DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration(HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT, HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT, udpCfg); ConnectionFactory cf = (ConnectionFactory)HornetQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.CF);
Awesome, thank you very much, Justin!
Now that you mention it, it makes sense (the refactor you did / additional layer of abstraction) in order to support JGroups alongside UDP.