All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ples.mule-example-loanbroker-esb.3.0.1.source-code.loan-broker-esb-mule-config-with-ejb-container.xml Maven / Gradle / Ivy

There is a newer version: 3.1.2
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:jee="http://www.springframework.org/schema/jee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:spring="http://www.springframework.org/schema/beans"
      xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
      xmlns:ejb="http://www.mulesoft.org/schema/mule/ejb"
      xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
      xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
      xmlns:client="http://www.mulesoft.org/schema/mule/client"      
      xsi:schemaLocation="
               http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
               http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
               http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
               http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd
               http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.0/mule-vm.xsd
               http://www.mulesoft.org/schema/mule/ejb http://www.mulesoft.org/schema/mule/ejb/3.0/mule-ejb.xsd
               http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.0/mule-jms.xsd
               http://www.mulesoft.org/schema/mule/client http://www.mulesoft.org/schema/mule/client/3.0/mule-client.xsd
               http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.0/mule-cxf.xsd">

    <description>
        The Loan Broker ESB example implements the Loan Broker Example using an ESB topology. See
        http://mule.mulesoft.org/wiki/display/MULE/LoanBroker+ESB for details.
    </description>

    <client:remote-dispatcher-agent>
        <client:remote-endpoint address="tcp://localhost:5555" exchange-pattern="request-response"/>
    </client:remote-dispatcher-agent>

    <spring:beans>
        <jee:remote-slsb id="creditAgencyEJB" jndi-name="local/CreditAgency"
                         business-interface="org.mule.example.loanbroker.credit.CreditAgency">
            <jee:environment>
                java.naming.factory.initial=org.openejb.client.LocalInitialContextFactory
                java.naming.provider.url=rmi://localhost:1099
                openejb.base=${mule.base}
                openejb.configuration=apps/loanbroker-esb/openejb.conf
                logging.conf=conf/log4j.properties
                openejb.nobanner=true
            </jee:environment>
        </jee:remote-slsb>
    </spring:beans>
    
    <jms:activemq-connector name="jmsConnector"/>

    <!--
    Examples of different types of Transformers are used here to show some of the built in features of Mule transformers
    -->

    <!-- custom transformers that implements the Mule Transformer API -->
    <custom-transformer name="RestRequestToCustomerRequest"
                             class="org.mule.example.loanbroker.transformers.RestRequestToCustomerRequest" />

    <custom-transformer name="CreditProfileXmlToCreditProfile"
                             class="org.mule.example.loanbroker.transformers.CreditProfileXmlToCreditProfile" />

    <!-- The expression transformer can be used to extract multiple arguments from the current message (as a List or Array)
     Here we use the 'bean' Expression Evaluator to extract the name and SSN of the customer we are performing a credit check on.
     These arguments are accepted by the EJB service -->
    <expression-transformer name="CustomerToCreditProfileArgs">
        <return-argument evaluator="bean" expression="name"/>
        <return-argument evaluator="bean" expression="ssn"/>
    </expression-transformer>

    <endpoint name="CustomerRequestsREST" 
        address="http://localhost:8888/loanbroker" exchange-pattern="one-way"/>
    <vm:endpoint name="CustomerRequests" path="customer.requests" exchange-pattern="request-response"/>
    <jms:endpoint name="CustomerResponses" queue="esb.loan.quotes" exchange-pattern="one-way"/>
    <jms:endpoint name="LoanQuotes" queue="esb.loan.quotes" exchange-pattern="one-way"/>
    <jms:endpoint name="CreditAgencyGateway" queue="esb.credit.agency" exchange-pattern="one-way"/>
    <vm:endpoint name="CreditAgency" path="credit.agency.service" exchange-pattern="one-way"/>
    <jms:endpoint name="LenderGateway" queue="esb.lender.service" exchange-pattern="one-way"/>
    <vm:endpoint name="LenderService" path="lender.service" exchange-pattern="request-response"/>
    <jms:endpoint name="BankingGateway" queue="esb.banks" exchange-pattern="one-way" />

    <endpoint name="Bank1" address="http://localhost:10080/mule/TheBank1" 
        exchange-pattern="request-response">
        <cxf:jaxws-client serviceClass="org.mule.example.loanbroker.bank.BankService" operation="getLoanQuote" />
    </endpoint>
    <endpoint name="Bank1In" address="http://localhost:10080/mule/TheBank1" 
        exchange-pattern="request-response">
        <cxf:jaxws-service serviceClass="org.mule.example.loanbroker.bank.BankService" />    
    </endpoint>
    
    <endpoint name="Bank2" address="http://localhost:20080/mule/TheBank2" 
        exchange-pattern="request-response">
        <cxf:jaxws-client serviceClass="org.mule.example.loanbroker.bank.BankService" operation="getLoanQuote" />
    </endpoint>
    <endpoint name="Bank2In" address="http://localhost:20080/mule/TheBank2" 
        exchange-pattern="request-response">
        <cxf:jaxws-service serviceClass="org.mule.example.loanbroker.bank.BankService" />    
    </endpoint>
    
    <endpoint name="Bank3" address="http://localhost:30080/mule/TheBank3" 
        exchange-pattern="request-response">
        <cxf:jaxws-client serviceClass="org.mule.example.loanbroker.bank.BankService" operation="getLoanQuote" />
    </endpoint>
    <endpoint name="Bank3In" address="http://localhost:30080/mule/TheBank3" 
        exchange-pattern="request-response">
        <cxf:jaxws-service serviceClass="org.mule.example.loanbroker.bank.BankService" />    
    </endpoint>

    <endpoint name="Bank4" address="http://localhost:40080/mule/TheBank4" 
        exchange-pattern="request-response">
        <cxf:jaxws-client serviceClass="org.mule.example.loanbroker.bank.BankService" operation="getLoanQuote" />
    </endpoint>
    <endpoint name="Bank4In" address="http://localhost:40080/mule/TheBank4" 
        exchange-pattern="request-response">
        <cxf:jaxws-service serviceClass="org.mule.example.loanbroker.bank.BankService" />    
    </endpoint>

    <endpoint name="Bank5" address="http://localhost:50080/mule/TheBank5" 
        exchange-pattern="request-response">
        <cxf:jaxws-client serviceClass="org.mule.example.loanbroker.bank.BankService" operation="getLoanQuote" />
    </endpoint>
    <endpoint name="Bank5In" address="http://localhost:50080/mule/TheBank5" 
        exchange-pattern="request-response">
        <cxf:jaxws-service serviceClass="org.mule.example.loanbroker.bank.BankService" />    
    </endpoint>
    
    <model name="loan-broker">
        <service name="LoanBroker">
            <description>
                The LoanBroker service is our 'entry' service that accepts requests from the outside world
            </description>
            <inbound>
                <inbound-endpoint ref="CustomerRequestsREST" transformer-refs="RestRequestToCustomerRequest"/>
                <inbound-endpoint ref="CustomerRequests"/>
            </inbound>

            <component class="org.mule.example.loanbroker.AsynchronousLoanBroker"/>

            <outbound>
                <pass-through-router>
                    <outbound-endpoint ref="CreditAgencyGateway"/>
                </pass-through-router>
            </outbound>

            <async-reply timeout="10000">
                <inbound-endpoint ref="LoanQuotes"/>
                <custom-async-reply-router class="org.mule.example.loanbroker.routers.BankQuotesResponseAggregator"/>
            </async-reply>
        </service>

        <service name="CreditAgencyGatewayService">
            <description>
                The credit agency service will get the credit profile for a customer.

                This service serves as a 'proxy' or 'gateway' to a back-end system. It is responsible for invoking the
                CreditAgency back-end service ensuring that the correct data is sent to the service and the data passed
                back is
                added to our bus message.
                This service uses a component binding to call out to the CreditAgency service before sending the bus
                message onto
                the next endpoint.
            </description>
            <inbound>
                <inbound-endpoint ref="CreditAgencyGateway"/>
            </inbound>
            <component class="org.mule.example.loanbroker.esb.CreditAgencyGateway">
                <binding interface="org.mule.example.loanbroker.credit.CreditAgencyService" method="getCreditProfile">
                    <!-- We invoke the credit Agency service using synchronous which means that a response
        will be returned from the service. there is also a responseTransformer that will
        conver the Xml returned from the CreditAgency Ejb into a CreditProfile object -->
                    <outbound-endpoint ref="CreditAgency" exchange-pattern="request-response" 
                        transformer-refs="CustomerToCreditProfileArgs"
                        responseTransformer-refs="CreditProfileXmlToCreditProfile" />
                </binding>
            </component>
            <outbound>
                <pass-through-router>
                    <outbound-endpoint ref="LenderGateway"/>
                </pass-through-router>
            </outbound>
        </service>


        <!--  This is the CreditAgency Ejb component.  The implementation is the Jndi naming location
        of the the Home interface for the CreditAgency bean.  This is just a single inbound endpoint which
        with return the result of the invocation
        -->
        <service name="CreditAgencyService">
            <description>
                Much like the previous service the is a gateway/proxy to a LenderService back-end application. In this
                instance the LenderService understands our bus message so we just use a chaining router to send the response form
                the Lender Service to the next endpoint.
            </description>
            <inbound>
                <inbound-endpoint ref="CreditAgency"/>
            </inbound>
            <component>
                <spring-object bean="creditAgencyEJB"/>
            </component>
        </service>

        <service name="LenderGatewayService">
            <description>
                Much like the previous service the is a gateway/proxy to a LenderService back-end application. In this instance
                the LenderService understands our bus message so we just use a chaining router to send the response form the
                Lender Service to the next endpoint.
            </description>
            <inbound>
                <inbound-endpoint ref="LenderGateway" />
            </inbound>
            <outbound>
                <chaining-router>
                    <outbound-endpoint ref="LenderService" exchange-pattern="request-response" />
                    <outbound-endpoint ref="BankingGateway" />
                </chaining-router>
            </outbound>
        </service>

        <service name="LenderServiceService">
            <description>
                Responsible for getting a list of lenders that will provide a Loan quote.
            </description>
            <inbound>
                <inbound-endpoint ref="LenderService" />
            </inbound>
            <component class="org.mule.example.loanbroker.lender.DefaultLender" />
        </service>

        <service name="BankingGatewayService">
            <description>
                This gateway is responsible for sending the Loan Reqest information to each of the Lenders.
            </description>
            <inbound>
                <inbound-endpoint ref="BankingGateway" />
            </inbound>
            <outbound>
                <expression-recipient-list-router evaluator="groovy" expression="payload.lenders.endpoint">
                    <reply-to address="LoanQuotes"/>
                        <expression-filter expression="payload.lenders.endpoint!=null" evaluator="groovy"/>
                 </expression-recipient-list-router>
            </outbound>
        </service>

        <!--
        These are mock bank services that represent remote bank loan services
        One or more of these are selected by the LenderService and a request
        is routed to them.   The lenderService outbound router also defines a
        replyTo property which will be used by Mule to route the responses back
        to the LoanBrokerQuotes destination
        -->
        <service name="TheBank1">
            <inbound>
                <inbound-endpoint ref="Bank1In"/>
            </inbound>
            <component class="org.mule.example.loanbroker.bank.Bank"/>
        </service>

        <service name="TheBank2">
            <inbound>
                <inbound-endpoint ref="Bank2In"/>
            </inbound>
            <component class="org.mule.example.loanbroker.bank.Bank"/>
        </service>

        <service name="TheBank3">
            <inbound>
                <inbound-endpoint ref="Bank3In"/>
            </inbound>
            <component class="org.mule.example.loanbroker.bank.Bank"/>
        </service>

        <service name="TheBank4">
            <inbound>
                <inbound-endpoint ref="Bank4In"/>
            </inbound>
            <component class="org.mule.example.loanbroker.bank.Bank"/>
        </service>

        <service name="TheBank5">
            <inbound>
                <inbound-endpoint ref="Bank5In"/>
            </inbound>
            <component class="org.mule.example.loanbroker.bank.Bank"/>
        </service>

    </model>

</mule>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy