<?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="vm://CreditAgencyService"/>
        <endpoint-identifier name="LenderService" value="vm://LenderService"/>
        <endpoint-identifier name="Bank1" value="vm://Bank1"/>
        <endpoint-identifier name="Bank2" value="vm://Bank2"/>
        <endpoint-identifier name="Bank3" value="vm://Bank3"/>
        <endpoint-identifier name="Bank4" value="vm://Bank4"/>
        <endpoint-identifier name="Bank5" value="vm://Bank5"/>
    </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.StaticRecipientList">
                    <reply-to address="LoanBrokerQuotes"/>
                    <filter expression="recipients!=null" className="org.mule.routing.filters.MessagePropertyFilter"/>
                </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>
                <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">
        </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>