-
1. Re: JMSBridge Fails over time
gaohoward Jul 18, 2013 9:58 AM (in response to rganger)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 Jul 18, 2013 3:07 PM (in response to gaohoward)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
gaohoward Jul 18, 2013 9:02 PM (in response to rganger)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