<?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.
-->         
<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://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
           http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

  <bean
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
      <list>
        <value>classpath:activemq-browse.properties</value>
      </list>
    </property>
    <property name="ignoreResourceNotFound" value="true" />
    <property name="searchSystemEnvironment" value="true" />
  </bean>

  <amq:broker brokerName="broker-2A" brokerId="broker-2A" useJmx="false"
  			  persistent="true" advisorySupport="true" deleteAllMessagesOnStartup="true">


    <amq:destinationInterceptors>
            <amq:virtualDestinationInterceptor>
              <amq:virtualDestinations>
                <!--  amq:virtualTopic name=">" prefix="VTopic.*." / -->
                <amq:compositeQueue name="PROD.FUSESOURCE">
                  <amq:forwardTo>
                    <amq:queue physicalName="PROD.FUSESOURCE.1.A"/>
                    <amq:queue physicalName="PROD.FUSESOURCE.1.B"/>
                    <amq:queue physicalName="PROD.FUSESOURCE.2.A"/>
                    <amq:queue physicalName="PROD.FUSESOURCE.2.B"/>
                    <amq:queue physicalName="PROD.FUSESOURCE.3.A"/>
                    <amq:queue physicalName="PROD.FUSESOURCE.3.B"/>
                  </amq:forwardTo>
                </amq:compositeQueue>
              </amq:virtualDestinations>
           </amq:virtualDestinationInterceptor>
    </amq:destinationInterceptors>


    <amq:destinationPolicy>
      <amq:policyMap>
        <amq:policyEntries>
          <amq:policyEntry topic=">" enableAudit="true">
            <amq:dispatchPolicy>
              <amq:priorityNetworkDispatchPolicy/>
            </amq:dispatchPolicy>
          </amq:policyEntry>
        </amq:policyEntries>
      </amq:policyMap>
    </amq:destinationPolicy>

    <!--  Network connectors -->
    <amq:networkConnectors>

      <amq:networkConnector uri="static:(${1a.uri})"
        name="2a_${1a.name}"
        networkTTL="6"
        prefetchSize="5"
        suppressDuplicateTopicSubscriptions="false"
        suppressDuplicateQueueSubscriptions="false"
        decreaseNetworkConsumerPriority="true">

        <amq:excludedDestinations>
          <amq:queue physicalName="PROD.FUSESOURCE.2.A"/>
        </amq:excludedDestinations>
        <amq:staticallyIncludedDestinations>
          <amq:queue physicalName="PROD.FUSESOURCE.1.A"/>
          <amq:queue physicalName="PROD.FUSESOURCE.1.B"/>
          <amq:queue physicalName="PROD.FUSESOURCE.2.B"/>
          <amq:queue physicalName="PROD.FUSESOURCE.3.A"/>
          <amq:queue physicalName="PROD.FUSESOURCE.3.B"/>
        </amq:staticallyIncludedDestinations>
      </amq:networkConnector>


      <amq:networkConnector uri="static:(${1b.uri})"
        name="2a_${1b.name}"
        networkTTL="6"
        prefetchSize="5"
        suppressDuplicateTopicSubscriptions="false"
        suppressDuplicateQueueSubscriptions="false"
        decreaseNetworkConsumerPriority="true">
        <amq:excludedDestinations>
          <amq:queue physicalName="PROD.FUSESOURCE.2.A"/>
        </amq:excludedDestinations>
        <amq:staticallyIncludedDestinations>
          <amq:queue physicalName="PROD.FUSESOURCE.1.A"/>
          <amq:queue physicalName="PROD.FUSESOURCE.1.B"/>
          <amq:queue physicalName="PROD.FUSESOURCE.2.B"/>
          <amq:queue physicalName="PROD.FUSESOURCE.3.A"/>
          <amq:queue physicalName="PROD.FUSESOURCE.3.B"/>
        </amq:staticallyIncludedDestinations>
      </amq:networkConnector>


      <amq:networkConnector uri="static:(${2b.uri})"
        name="2a_${2b.name}"
        networkTTL="6"
        prefetchSize="5"
        suppressDuplicateTopicSubscriptions="false"
        suppressDuplicateQueueSubscriptions="false"
        decreaseNetworkConsumerPriority="true">
        <amq:excludedDestinations>
          <amq:queue physicalName="PROD.FUSESOURCE.2.A"/>
        </amq:excludedDestinations>
        <amq:staticallyIncludedDestinations>
          <amq:queue physicalName="PROD.FUSESOURCE.1.A"/>
          <amq:queue physicalName="PROD.FUSESOURCE.1.B"/>
          <amq:queue physicalName="PROD.FUSESOURCE.2.B"/>
          <amq:queue physicalName="PROD.FUSESOURCE.3.A"/>
          <amq:queue physicalName="PROD.FUSESOURCE.3.B"/>
        </amq:staticallyIncludedDestinations>
      </amq:networkConnector>

      <amq:networkConnector uri="static:(${3a.uri})"
        name="2a_${3a.name}"
        networkTTL="6"
        prefetchSize="5"
        suppressDuplicateTopicSubscriptions="false"
        suppressDuplicateQueueSubscriptions="false"
        decreaseNetworkConsumerPriority="true">

        <amq:excludedDestinations>
          <amq:queue physicalName="PROD.FUSESOURCE.2.A"/>
        </amq:excludedDestinations>
        <amq:staticallyIncludedDestinations>
          <amq:queue physicalName="PROD.FUSESOURCE.1.A"/>
          <amq:queue physicalName="PROD.FUSESOURCE.1.B"/>
          <amq:queue physicalName="PROD.FUSESOURCE.2.B"/>
          <amq:queue physicalName="PROD.FUSESOURCE.3.A"/>
          <amq:queue physicalName="PROD.FUSESOURCE.3.B"/>
        </amq:staticallyIncludedDestinations>
      </amq:networkConnector>

      <amq:networkConnector uri="static:(${3b.uri})"
        name="2a_${3b.name}"
        networkTTL="6"
        prefetchSize="5"
        suppressDuplicateTopicSubscriptions="false"
        suppressDuplicateQueueSubscriptions="false"
        decreaseNetworkConsumerPriority="true">
        <amq:excludedDestinations>
          <amq:queue physicalName="PROD.FUSESOURCE.2.A"/>
        </amq:excludedDestinations>
        <amq:staticallyIncludedDestinations>
          <amq:queue physicalName="PROD.FUSESOURCE.1.A"/>
          <amq:queue physicalName="PROD.FUSESOURCE.1.B"/>
          <amq:queue physicalName="PROD.FUSESOURCE.2.B"/>
          <amq:queue physicalName="PROD.FUSESOURCE.3.A"/>
          <amq:queue physicalName="PROD.FUSESOURCE.3.B"/>
        </amq:staticallyIncludedDestinations>
      </amq:networkConnector>

    </amq:networkConnectors>

    <amq:persistenceAdapter>
       <amq:kahaDB directory="${2a.data}"/>
    </amq:persistenceAdapter>

	<amq:plugins>
       	<amq:timeStampingBrokerPlugin futureOnly="true"/>
	</amq:plugins>

    <amq:transportConnectors>
      <amq:transportConnector uri="${2a.transport}" />
    </amq:transportConnectors>

  </amq:broker>




</beans>
