3 Replies Latest reply on Jul 18, 2013 9:02 PM by Yong Hao Gao

    JMSBridge Fails over time

    rganger Newbie

      I am using the HornetQ JMSBridge in JBOSS 7.1.1 to bridge HornetQ and ActiveMQ topics. At startup this runs fine for a period of time. After a while (maybe 1000 messages or so), the bridge stops delivering messages. My bridge configuration is contained in a SAR file, and a simple touch of the file resets the bridge and all starts working again (incidentally, since 7.1.1 doesn't support configuration of the bridge in standalone.xml, I'm creating the bridge beans using Spring). It appears that the messages sent across the bridge are left in "IN DELIVERY" status even whern they have been delivered to ActiveMQ (or delivered to a local consumer for incoming topics). Does anyone know the optimal settings/parameters for the JMSBridge that would make sure that there are no residual messages left around? Once the messages go to a consumer, I would expect that they should disappear.

       

      Thanks in advance.


        • 1. Re: JMSBridge Fails over time
          Yong Hao Gao Master

          Hi Can you put your discussion to the user's forum? https://community.jboss.org/en/hornetq

           

          Here we discuss development topics. Please attach your bridge configuration if available.

           

          Howard

          • 2. Re: JMSBridge Fails over time
            rganger Newbie

            My apologies for posting in the wrong forum. Below is an excerpt from my Spring configuration file:

             

            The are multiple bridges configured as such:

             

            <!-- Bridge from local HornetQ to remote ActiveMQ -->

            <bean id="hornetqToActivemqJmsBridge" class="org.hornetq.jms.bridge.impl.JMSBridgeImpl">

                 <!-- Source ConnectionFactory Factory -->

                 <constructor-arg ref="localCFF" />

                 <!-- Target ConnectionFactory Factory -->

                 <constructor-arg ref="remoteCFF" />

                 <!-- Source DestinationFactory -->

                 <constructor-arg ref="localTestTopicDF_0" />

                 <!-- Target DestinationFactory -->

                 <constructor-arg ref="remoteTestTopicDF_0" />

                 <!-- Source User Name (no username here) -->

                 <constructor-arg><null /></constructor-arg>

                 <!-- Source Password (no password here)-->

                 <constructor-arg><null /></constructor-arg>

                 <!-- Target User Name (no username here)-->

                 <constructor-arg><null /></constructor-arg>

                 <!-- Target Password (no password here)-->

                 <constructor-arg><null /></constructor-arg>

                 <!-- Selector -->

                 <constructor-arg><null /></constructor-arg>

                 <!-- Failure Retry Interval (in ms) -->

                 <constructor-arg type="long"><value>1000</value></constructor-arg>

                 <!-- Max Retries -->

                 <constructor-arg type="int"><value>1</value></constructor-arg>

                 <!-- Quality Of Service -->

                 <constructor-arg type="org.hornetq.jms.bridge.QualityOfServiceMode">

                    <value>AT_MOST_ONCE</value>

                 </constructor-arg>

                 <!-- Max Batch Size -->

                 <constructor-arg type="int"><value>1</value></constructor-arg>

                 <!-- Max Batch Time (-1 means infinite) -->

                 <constructor-arg type="long"><value>-1</value></constructor-arg>

                 <!-- Subscription name (no subscription name here)-->

                 <constructor-arg><null /></constructor-arg>

                 <!-- Client ID  (no client ID here)-->

                 <constructor-arg><null /></constructor-arg>

                 <!-- Add MessageID In Header -->

                 <constructor-arg type="boolean"><value>true</value></constructor-arg>

            </bean>

             

            <!-- Connection Factories  for local and remote brokers -->

            <bean id="localCFF" class="org.hornetq.jms.bridge.impl.JNDIConnectionFactoryFactory">

                                <constructor-arg ref="localJNDI" />

                                <constructor-arg value="java:/ConnectionFactory" />

            </bean>

             

            <bean id="remoteCFF" class="org.hornetq.jms.bridge.impl.JNDIConnectionFactoryFactory">

              <constructor-arg ref="remoteJNDI_0" />

                                <constructor-arg value="ConnectionFactory" />

            </bean>

             

            <!-- Destination Factories for each local or remote topics -->

            <bean id="localTestTopicDF_0" class="org.hornetq.jms.bridge.impl.JNDIDestinationFactory">

                                <constructor-arg ref="localJNDI" />

                                <constructor-arg value="/topic/test" />

            </bean>

             

            <bean id="remoteTestTopicDF_0" class="org.hornetq.jms.bridge.impl.JNDIDestinationFactory">

                                <constructor-arg ref="remoteJNDI_0" />

                                <constructor-arg value="testTopicjndi" />

            </bean>

             

            <!-- JNDI Properties -->

            <!-- Defines the JNDI Parameters for the local HornetQ broker on any topic -->

            <bean id="localJNDI" class="java.util.Hashtable">

                                <constructor-arg>

                                          <map>

                                                    <entry key="java.naming.factory.initial">

                                                              <value>org.jboss.as.naming.InitialContextFactory</value>

                                                    </entry>

                                                    <entry key="java.naming.provider.url">

                                                              <value>jnp://localhost:1099</value>

                                                    </entry>

                                          </map>

                                </constructor-arg>

            </bean>

             

             

            <!-- Defines the JNDI Parameters for the remote ActiveMQ broker for testTopic -->

            <bean id="remoteJNDI_0" class="java.util.Hashtable">

                                <constructor-arg>

                                          <map>

                                                    <entry key="java.naming.factory.initial">

                                                              <value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value>

                                                    </entry>

                                                    <entry key="java.naming.provider.url">

                                                              <value>failover://(tcp://localhost:61616?closeAsync=false)</value>

                                                    </entry>

                                                    <entry key="topic.testTopicjndi">

                                                              <value>testTopic</value>

                                                    </entry>

                                          </map>

                                </constructor-arg>

            </bean>

             

             

            I'm also using a org.springframework.transaction.jta.JtaTransactionManager that gets set for each bridge as follows:

             

            try

            {

                TransactionManager tm = txManager.getTransactionManager();

                jmsBridge.setTransactionManager(tm);

                jmsBridge.start();

            } catch (Exception e)

            {

            ...

            }

             

            Since I'm a newbie, I apologize if the code is not presented without the correct meta-tags or formatting (still figuring the forum out).

             

            Thanks in advance.

            • 3. Re: JMSBridge Fails over time
              Yong Hao Gao Master

              It seems to me that if you have set a TransactionManager you are supposed to use ONCE_AND_ONLY_ONCE mode. But in your config you set AT_MOST_ONCE, which doesn't need a transaction manager.

              I'd suggest you use ONCE_AND_ONLY_ONCE if you really care that each message must be bridged.

               

              Howard