<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mule-configuration PUBLIC "-//SymphonySoft //DTD mule-configuration XML V1.0//EN"
                                "http://www.symphonysoft.com/dtds/mule/mule-configuration.dtd">

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

    <mule-environment-properties synchronous="true" serverUrl=""/>
    
    <agents>
        <agent name="JmxAgent" className="org.mule.management.agents.JmxAgent"/>
        <agent name="JdmkAgent" className="org.mule.management.agents.JdmkAgent"/>
    </agents>

    <endpoint-identifiers>
        <endpoint-identifier name="LoanBrokerRequests" value="vm://LoanBrokerRequests"/>
        <endpoint-identifier name="LoanBrokerQuotes" value="vm://LoanQuotes"/>
        <endpoint-identifier name="CreditAgency" value="axis:http://localhost:18080/mule/CreditAgencyService?method=getCreditProfile"/>
        <endpoint-identifier name="CreditAgencyReceiver" value="axis:http://localhost:18080/mule"/>
        <endpoint-identifier name="LenderService" value="vm://localhost/LenderService?method=setLenderList"/>
        <!-- The method parameter for the bank endpoints is added programmitcally when the bank objects are
        created -->
        <endpoint-identifier name="Bank1" value="axis:http://localhost:10080/mule"/>
        <endpoint-identifier name="Bank2" value="axis:http://localhost:20080/mule"/>
        <endpoint-identifier name="Bank3" value="axis:http://localhost:30080/mule"/>
        <endpoint-identifier name="Bank4" value="axis:http://localhost:40080/mule"/>
        <endpoint-identifier name="Bank5" value="axis:http://localhost:50080/mule"/>
    </endpoint-identifiers>

<!--    <endpoint-identifiers>-->
<!--        <endpoint-identifier name="LoanBrokerRequests" value="vm://LoanBrokerRequests"/>-->
<!--        <endpoint-identifier name="LoanQuotes" value="vm://LoanQuotes"/>-->
<!--        <endpoint-identifier name="CreditAgency" value="glue:http://localhost:18080/mule/CreditAgencyService?method=getCreditProfile"/>-->
<!--        <endpoint-identifier name="CreditAgencyReceiver" value="glue:http://localhost:18080/mule"/>-->
<!--        <endpoint-identifier name="LenderService" value="vm://localhost/LenderService?method=setLenderList"/>-->
<!--        <endpoint-identifier name="Bank1" value="glue:http://localhost:10080/mule"/>-->
<!--        <endpoint-identifier name="Bank2" value="glue:http://localhost:20080/mule"/>-->
<!--        <endpoint-identifier name="Bank3" value="glue:http://localhost:30080/mule"/>-->
<!--        <endpoint-identifier name="Bank4" value="glue:http://localhost:40080/mule"/>-->
<!--        <endpoint-identifier name="Bank5" value="glue:http://localhost:50080/mule"/>-->
<!--    </endpoint-identifiers>-->

    <model name="loan-broker">
        <mule-descriptor name="LoanBroker"
            implementation="org.mule.samples.loanbroker.SyncLoanBroker">
            <inbound-router>
                <endpoint address="LoanBrokerRequests"/>
            </inbound-router>

            <outbound-router>
                <router className="org.mule.routing.outbound.FilteringOutboundRouter">
                    <endpoint address="CreditAgency"/>
                    <filter expectedType="org.mule.samples.loanbroker.Customer" className="org.mule.routing.filters.PayloadTypeFilter"/>
                </router>
                <router className="org.mule.routing.outbound.FilteringOutboundRouter">
                    <endpoint address="LenderService"/>
                    <filter expectedType="org.mule.samples.loanbroker.BankQuoteRequest" className="org.mule.routing.filters.PayloadTypeFilter"/>
                </router>
            </outbound-router>
            <response-router timeout="100000">
                <endpoint address="LoanBrokerQuotes"/>
                <router className="org.mule.samples.loanbroker.routers.BankQuotesResponseAggregator"/>
            </response-router>
        </mule-descriptor>

        <mule-descriptor name="CreditAgencyService"
            inboundEndpoint="CreditAgencyReceiver"
            implementation="org.mule.samples.loanbroker.DefaultCreditAgencyService">
        </mule-descriptor>

        <mule-descriptor name="LenderService"
            inboundEndpoint="LenderService"
            implementation="org.mule.samples.loanbroker.DefaultLenderService">
            <outbound-router>
                <router className="org.mule.routing.outbound.StaticRecipientList">
                    <reply-to address="LoanBrokerQuotes"/>
                    <filter expression="recipients!=null" className="org.mule.routing.filters.MessagePropertyFilter"/>
                </router>
            </outbound-router>
        </mule-descriptor>

        <mule-descriptor name="Bank1"
            inboundEndpoint="Bank1"
            implementation="org.mule.samples.loanbroker.Bank">
        </mule-descriptor>

        <mule-descriptor name="Bank2"
            inboundEndpoint="Bank2"
            implementation="org.mule.samples.loanbroker.Bank">
        </mule-descriptor>

        <mule-descriptor name="Bank3"
            inboundEndpoint="Bank3"
            implementation="org.mule.samples.loanbroker.Bank">
        </mule-descriptor>

        <mule-descriptor name="Bank4"
            inboundEndpoint="Bank4"
            implementation="org.mule.samples.loanbroker.Bank">
        </mule-descriptor>

        <mule-descriptor name="Bank5"
            inboundEndpoint="Bank5"
            implementation="org.mule.samples.loanbroker.Bank">
        </mule-descriptor>
    </model>
</mule-configuration>