<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE mule-configuration PUBLIC "-//MuleSource //DTD mule-configuration XML V1.0//EN"
        "http://mule.mulesource.org/dtds/mule-configuration.dtd">

<mule-configuration id="http_test" version="1.0">

    <container-context className="org.mule.module.spring.SpringContainerContext">
        <properties>
            <text-property name="configuration">
                <![CDATA[
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <constructor-arg>
            <value>vm://localhost?broker.persistent=false&amp;broker.useJmx=false</value>
        </constructor-arg>
    </bean>
</beans>                ]]>
            </text-property>
        </properties>
    </container-context>

    <!--Connectors Used-->

    <connector name="jmsConnector1" className="org.mule.transport.jms.JmsConnector">
        <properties>
            <container-property name="connectionFactory" reference="jmsConnectionFactory"/>
            <!--<property name="connectionFactoryJndiName" value="ConnectionFactory"/>-->
            <!--<property name="jndiInitialFactory" value="org.activemq.jndi.ActiveMQInitialContextFactory"/>-->
            <!--<property name="jndiProviderUrl" value="tcp://localhost:61616"/>-->
            <property name="specification" value="1.1"/>
            <property name="jndiDestinations" value="false"/>
            <property name="maxRedelivery" value="2"/>
        </properties>
        <threading-profile maxThreadsActive="2" maxThreadsIdle="2" threadTTL="60000" poolExhaustedAction="WAIT"/>
    </connector>


    <connector name="jmsConnector2" className="org.mule.transport.jms.JmsConnector">
        <properties>
            <container-property name="connectionFactory" reference="jmsConnectionFactory"/>
            <!--<property name="connectionFactoryJndiName" value="ConnectionFactory"/>-->
            <!--<property name="jndiInitialFactory" value="org.activemq.jndi.ActiveMQInitialContextFactory"/>-->
            <!--<property name="jndiProviderUrl" value="tcp://localhost:61616"/>-->
            <property name="specification" value="1.1"/>
            <property name="jndiDestinations" value="false"/>
            <property name="maxRedelivery" value="2"/>
        </properties>
        <threading-profile maxThreadsActive="5" maxThreadsIdle="5" threadTTL="60000" poolExhaustedAction="WAIT"/>
    </connector>

    <connector name="clientConnector" className="org.mule.transport.jms.JmsConnector">
        <properties>
            <container-property name="connectionFactory" reference="jmsConnectionFactory"/>
            <property name="specification" value="1.1"/>
        </properties>
    </connector>


    <!-- Endpoints -->
    <endpoint-identifiers>
        <!--<endpoint-identifier name="FROM.QUEUE.ONE" value="jms://TEST.FROM.QUEUE.ONE?connector=connector1"/>-->
        <!--<endpoint-identifier name="TO.QUEUE.ONE" value="jms://TEST.FROM.QUEUE.ONE?connector=connector1"/>-->

        <!--<endpoint-identifier name="FROM.QUEUE.TWO" value="jms://TEST.FROM.QUEUE.TWO?connector=connector2"/>-->
        <!--<endpoint-identifier name="TO.QUEUE.TWO" value="jms://TEST.FROM.QUEUE.TWO?connector=connector2"/>-->

        <!-- CSP -->
        <endpoint-identifier name="endpoint1" value="jms://cn=endpoint1?connector=jmsConnector1"/>
        <endpoint-identifier name="endpoint2" value="jms://cn=endpoint2?connector=jmsConnector2"/>
        <endpoint-identifier name="endpoint3" value="jms://cn=endpoint3?connector=jmsConnector2"/>

        <!-- RM* added fr testing with different connecotr factory -->
        <endpoint-identifier name="client-endpoint1" value="jms://cn=endpoint1?connector=clientConnector"/>
        <endpoint-identifier name="client-endpoint2" value="jms://cn=endpoint2?connector=clientConnector"/>
        <endpoint-identifier name="client-endpoint3" value="jms://cn=endpoint3?connector=clientConnector"/>
    </endpoint-identifiers>

    <model name="bus-instance">

        <mule-descriptor name="service1" implementation="org.mule.component.simple.EchoComponent">
            <inbound-router>
                <endpoint address="endpoint1" type="receiver" synchronous="true">
                    <transaction action="ALWAYS_BEGIN" factory="org.mule.transport.jms.JmsTransactionFactory"/>
                </endpoint>
            </inbound-router>
            <outbound-router>
                <router className="org.mule.routing.outbound.StaticRecipientList" enableCorrelation="ALWAYS">
                    <properties>
                        <list name="recipients">
                            <entry value="jms://cn=endpoint3?connector=jmsConnector1"/>
                        </list>
                    </properties>
                </router>
            </outbound-router>

        </mule-descriptor>


        <mule-descriptor name="service2" implementation="org.mule.component.simple.EchoComponent">
            <inbound-router>
                <endpoint address="endpoint2" type="receiver" synchronous="true">
                    <transaction action="ALWAYS_BEGIN" factory="org.mule.transport.jms.JmsTransactionFactory"/>
                </endpoint>
            </inbound-router>

            <outbound-router>
                <router className="org.mule.routing.outbound.StaticRecipientList" enableCorrelation="ALWAYS">
                    <properties>
                        <list name="recipients">
                            <entry value="jms://cn=endpoint3?connector=jmsConnector2"/>
                        </list>
                    </properties>
                </router>
            </outbound-router>
        </mule-descriptor>

    </model>


</mule-configuration>