<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
   
    http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

  <!-- remote broker -->

  <bean id="remotebroker" class="org.apache.activemq.broker.BrokerService" 
    init-method="start">
    <property name="brokerName" value = "remotebroker"/>
    <property name="persistent" value = "false"/>
    <property name="transportConnectorURIs">
      <list>
        <value>tcp://localhost:61666</value>
      </list>
      </property>
  </bean>

  <!-- JMS ConnectionFactory to use remote -->
  <bean id="remoteFactory"
    class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="tcp://localhost:61666" />
  </bean>
  
  
  <!-- local broker with embedded Jms to Jms bridge (ok - it's contrived) -->
  <bean id="localbroker" class="org.apache.activemq.broker.BrokerService" 
    init-method="start">
    <property name="brokerName" value = "localBroker"/>
      <property name="persistent" value = "false"/>
    <property name="transportConnectorURIs">
      <list>
        <value>tcp://localhost:61234</value>
      </list>
    </property>
    <property name="jmsBridgeConnectors">
      <list>
      	<ref bean="jmsConnector"/>
      </list>
    </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:61234" />
  </bean>
  
  <!--JmsTopicConnector - the Jms bridge -->
  <bean id="jmsConnector"
  	class="org.apache.activemq.network.jms.SimpleJmsTopicConnector">
  	<property name = "outboundTopicConnectionFactory" ref = "remoteFactory"/>
  	
  	<property name = "inboundTopicBridges">
  	 <list>
  	  <ref bean="InboundTopicBridge" />
  	 </list>
  	 </property>

  </bean>

  <bean id ="InboundTopicBridge" class="org.apache.activemq.network.jms.InboundTopicBridge">
  	<property name = "inboundTopicName" value = "org.apache.activemq.network.jms.TopicBridgeSpringTest"/>
  </bean>
</beans>



