2 Replies Latest reply on Jul 10, 2014 6:18 PM by ptenn10

    DiscoveryGroupConfiguration changes from HornetQ 2.2 to HornetQ 2.4

    ptenn10

      Hi All,

       

      I am attempting to write JMS Client code (runs inside a WAR in a JBoss EAP 6.2 server instance) that sends messages to a HornetQ Cluster.  The HornetQ Cluster uses multicast UDP.

       

      I tried to migrate some code from HornetQ 2.2 to HornetQ 2.4 client and ran into problems/confusion.

       

      Here is my code for creating a ConnectionFactory using HornetQ 2.2 Client:

       

       

                  
                  DiscoveryGroupConfiguration discoveryGroup = new DiscoveryGroupConfiguration("231.7.7.7", 9876);
                  HornetQConnectionFactory connectionFactory =
                     HornetQJMSClient.createConnectionFactoryWithHA(discoveryGroup, JMSFactoryType.CF);
      

       

      I tried to migrate to a HornetQ 2.4 Client, but appears that the entire DiscoveryGroupConfiguration class has changed.

       

      I went through the JavaDocs: HornetQ Core Client 2.4.0.Final API for DiscoveryGroupConfiguration, BroadcastEndpointFactoryConfiguration, DiscoveryGroupConfigurationCompatibilityHelper.  I can see that these all interact.

       

      However, I could not figure out how (using HornetQ 2.4 Client API) to do the equivalent of the code snippet I have in HornetQ 2.2. It looked like the API for 2.4 was much more complex and required information (like local bind address/port) that I do not have.

       

      Has anyone done this before?  I would really appreciate any help or advice.

       

      Thank you very much!

       

      - Philip

        • 1. Re: DiscoveryGroupConfiguration changes from HornetQ 2.2 to HornetQ 2.4
          jbertram

          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("231.7.7.7", 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);
          
          


          • 2. Re: DiscoveryGroupConfiguration changes from HornetQ 2.2 to HornetQ 2.4
            ptenn10

            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.

             

            Thanks,

             

            Philip