activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From moonbird <moonb...@ymail.com>
Subject JMS to JMS Bridge - ActiveMQ to JBoss Messaging
Date Sat, 12 Sep 2009 20:26:03 GMT

Hi,

I have an AMQ 5.3.0 instance with some queues and I like to bridge them (via
AMQ) to JBoss Messaging 1.x which is embedded in JBoss 5 AS. (JBoss with
JBoss Messaging and AMQ-standalone instance are installed for the
development on the same computer...)

So I like to bridge FROM the AMQ queue: "APP.FIS.queue"
to the JBoss Messaging queue: "queue/JBossFISQueue"

This is my activemq.xml configuration:

<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">

    <!-- Allows us to use system properties as variables in this
configuration file -->
    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.base}/conf/credentials.properties</value>
        </property>      
    </bean>

    <broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" dataDirectory="${activemq.base}/data">
        
        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>

        <persistenceAdapter>
            <kahaDB directory="${activemq.base}/data/kahadb"/>
        </persistenceAdapter>
                
        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>
		
		<destinations>
			<queue physicalName="APP.FIS.queue" />
			<queue physicalName="APP.SIS.queue" />
		</destinations>
		
		<jmsBridgeConnectors>
        	<jmsQueueConnector name="APP-FIS-BRIDGE-Outbound"
        		<!-- used for locating the Connection Factory for the ActiveMQ
Connection if the localQueueConnection or localQueueConnectionFactory is not
set-->
           		jndiOutboundTemplate="#remoteJndi"
           		<!-- used to initialize the foreign JMS Connection if
localQueueConnection is not set -->
           		outboundQueueConnectionFactoryName="ConnectionFactory"
           		<!-- used to initialize the ActiveMQ JMS Connection if
localQueueConnection is not set -->
           		localQueueConnectionFactory="#localFactory">
        		<!-- an array of OutboundQueueBridge instances - used for defining
destinations that will be forwarded to the foreign JMS provider -->
        		<outboundQueueBridges>
        			<!-- the name of the local ActiveMQ Queue -->
        			<outboundQueueBridge localQueueName="APP.FIS.queue"/>
        			<!-- the foreign queue (jndi)name to send to -->
        			<outboundQueueBridge outboundQueueName="queue/JBossFISQueue"/>
       			</outboundQueueBridges>
       		</jmsQueueConnector>
		</jmsBridgeConnectors>
	
    </broker>

	<!-- Set up the template for connecting to JBoss Messaging -->
	<bean id="remoteJndi" class="org.springframework.jndi.JndiTemplate">
      <property name="environment">
        <props>
          <prop key="java.naming.provider.url">jnp://127.0.0.1:1099</prop>
          <prop
key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>

        </props>
      </property>
    </bean>
    
    <!-- JMS ConnectionFactory to use local broker (the one with the bridge)
-->
  	<bean id="localFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
    	<property name="brokerURL" value="tcp://localhost:61616" />
  	</bean>
  
    <import resource="activemq-jetty.xml"/>
    
</beans>

As long as I dont use:

<!-- the name of the local ActiveMQ Queue -->
<outboundQueueBridge localQueueName="APP.FIS.queue"/>

...the broker starts without any errors, but how do I tell ActiveMQ which is
the destination it has to bridge FROM ? without this line the bridge only
knows where TO bridge (the JBoss destination).

If i uncomment the line, I get the following error message:

java.lang.NullPointerException
	at javax.naming.InitialContext.getURLScheme(InitialContext.java:228)
	at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:277)
	at javax.naming.InitialContext.lookup(InitialContext.java:351)
	at
org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
	at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)
	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
	at
org.apache.activemq.network.jms.JmsQueueConnector.createForeignQueue(JmsQueueConnector.java:398)
	at
org.apache.activemq.network.jms.JmsQueueConnector.initializeOutboundQueueBridges(JmsQueueConnector.java:301)
	at
org.apache.activemq.network.jms.JmsQueueConnector.init(JmsQueueConnector.java:59)
	at
org.apache.activemq.network.jms.JmsConnector.start(JmsConnector.java:116)
...

Thank you very much so far!

-- 
View this message in context: http://www.nabble.com/JMS-to-JMS-Bridge---ActiveMQ-to-JBoss-Messaging-tp25417921p25417921.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message