5 Replies Latest reply on Jul 2, 2013 5:09 PM by Adam Mautner

    HornetQJMSConnectionFactory: Lookup Queue Instances from JGroups (in Spring)

    Adam Mautner Newbie

      Hi All,

       

      I am evaluating HornetQ for building production systems.

       

      I am trying to connect to HornetQ from Spring (to push messages to Flex using SpringFlex/BlazeDS). I am experimenting with HA and fail-over features of HornetQ.

       

      I managed to setup HA HornetQ using the following config:

       

          <bean name="connectionFactory" class="org.hornetq.jms.client.HornetQJMSConnectionFactory">

              <constructor-arg value="true" />

              <constructor-arg>

                     <list>

                      <bean class="org.hornetq.api.core.TransportConfiguration">

                          <constructor-arg

                              value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" />

                          <constructor-arg>

                              <map key-type="java.lang.String" value-type="java.lang.Object">

                                  <entry key="port" value="5445"></entry>

                              </map>

                          </constructor-arg>

                      </bean>

                      <bean class="org.hornetq.api.core.TransportConfiguration">

                          <constructor-arg

                              value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" />

                          <constructor-arg>

                              <map key-type="java.lang.String" value-type="java.lang.Object">

                                  <entry key="port" value="5446"></entry>

                              </map>

                          </constructor-arg>

                      </bean>

                  </list>

              </constructor-arg>

              <property name="reconnectAttempts" value="-1"/>

          </bean>

       

      It is working well, but I need to hard code the host and port of the live and backup servers.

       

      Is there a way to look-up servers using JGroups? That would be much more flexible.

       

      Regards,

       

      Adam