6 Replies Latest reply on Jun 17, 2011 6:08 AM by piotrekde

    HornetQ 2.2.2.Final and Spring Framework integration.

    piotrekde Newbie

      Hello,

       

      In our project built on a top of Spring Framework we use HornetQ in 2.0.0.GA version. Now, we'd like to migrate to the newest 2.2.2.Final release and use clustering option.


      Could you please provide sample Spring context configuration which works with clustered 2.2.2.Final?

       

      We've tried using HornetQJMSClient (http://docs.jboss.org/hornetq/2.2.2.Final/api/org/hornetq/api/jms/HornetQJMSClient.html), as it has  DiscoveryGroupConfiguration constructor parameter, however it causes many errors about not closed connections.

       

      Here it is (version for single broker):

       

        <beans:bean id="connectionFactory"
          class="org.springframework.jms.connection.CachingConnectionFactory">
          <beans:property name="targetConnectionFactory" ref="targetConnectionFactory" />
          <beans:property name="sessionCacheSize" value="10" />
          <beans:property name="cacheProducers" value="false" />
        </beans:bean>
      
          <util:constant id="QUEUE_XA_CF" static-field="org.hornetq.api.jms.JMSFactoryType.QUEUE_XA_CF" />
      
      
          <beans:bean name="targetConnectionFactory" class="org.hornetq.api.jms.HornetQJMSClient" factory-method="createConnectionFactoryWithoutHA">
            <beans:constructor-arg index="0" ref="QUEUE_XA_CF"/>
            <beans:constructor-arg index="1" ref="transportConfiguration"/>
          </beans:bean>
      
            <beans:bean name="transportConfiguration" class="org.hornetq.api.core.TransportConfiguration">
              <beans:constructor-arg
                value="org.hornetq.integration.transports.netty.NettyConnectorFactory" />
              <beans:constructor-arg>
                <beans:map key-type="java.lang.String" value-type="java.lang.Object">
                  <beans:entry key="host" value="localhost" />
                  <beans:entry key="port" value="5445" />
                </beans:map>
              </beans:constructor-arg>
            </beans:bean>
      
      

       

       

      Generally, we'd like to configure targetConnectionFactory with clustering option (multicast addressing), and then pass it to Spring CachingConnectionFactory.

      Any help is appreciated. Thanks in advance,

      Piotr