Embedding HornetQ and a Bridge
abendt Dec 11, 2009 11:08 AMHi,
i'm trying to embed HornetQ and a Hornet Bridge into an application. The plan is to let the application put its messages into the embedded queue and enable a Bridge whenever the Network is available. Then the Bridge should push all Messages into another (remote) queue.
So far I've followed the embedding examples. This worked fine for the embedded queue part. Right now I'm struggling to set up the Bridge.
The Bridge tries to locate a Transaction Manager. Can I use the Bridge without one?
Here's my setup code so far:
bridge = new JMSBridgeImpl(); Properties props = new Properties(); InputStream in = getClass().getResourceAsStream("/jndi.properties"); props.load(in); in.close(); ic = new InitialContext(props); bridge.setSourceConnectionFactoryFactory(new ConnectionFactoryFactory() { public ConnectionFactory createConnectionFactory() throws Exception { return hornetServer.getConnectionFactory(); } }); bridge.setSourceDestinationFactory(new DestinationFactory() { public Destination createDestination() throws Exception { return new HornetQQueue("embeddedQueue"); } }); bridge.setTargetConnectionFactoryFactory(new ConnectionFactoryFactory() { public ConnectionFactory createConnectionFactory() throws Exception { return (ConnectionFactory) ic.lookup("ConnectionFactory"); } }); bridge.setTargetDestinationFactory(new DestinationFactory() { public Destination createDestination() throws Exception { return (Queue)ic.lookup("remoteQueue"); } }); bridge.setFailureRetryInterval(5000L); bridge.setMaxRetries(-1); bridge.setMaxBatchSize(10); bridge.setMaxBatchTime(1000); bridge.setQualityOfServiceMode(QualityOfServiceMode.DUPLICATES_OK); bridge.start();
bridge.start() throws the following exception:
java.lang.RuntimeException: Unable to locate the transaction manager at org.jboss.tm.TransactionManagerLocator.locate(TransactionManagerLocator.java:134) at org.jboss.tm.TransactionManagerLocator.locate(TransactionManagerLocator.java:113) at org.hornetq.jms.bridge.impl.JMSBridgeImpl.getTm(JMSBridgeImpl.java:747) at org.hornetq.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:231) at com.kiongroup.tdm.fe.messaging.impl.JMSBridge.start(JMSBridge.java:81)
Using HornetQ 2.0.0.Beta5 and trying to connect to a JBoss EAP 5.0.0
How do I need to setup the bridge. Does anyone has a working example?
thanks in advance,
Alphonse Bendt