ples.mule-example-loanbroker-esb.3.0.1.source-code.loan-broker-esb-mule-config.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" 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:http="http://www.mulesoft.org/schema/mule/http" 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/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/http http://www.mulesoft.org/schema/mule/http/3.0/mule-http.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> <!-- Import property placeholders --> <context:property-placeholder location="openejb.properties"/> <ejb:connector name="ejbConnector" securityPolicy="security.policy" jndiInitialFactory="org.openejb.client.LocalInitialContextFactory"> <jndi-provider-property key="openejb.base" value="${openejb.base}"/> <jndi-provider-property key="openejb.configuration" value="${openejb.configuration}"/> <jndi-provider-property key="logging.conf" value="${logging.conf}"/> <jndi-provider-property key="openejb.nobanner" value="${openejb.nobanner}"/> </ejb:connector> <jms:activemq-connector name="jmsConnector" /> <http:connector name="http.connector"> <receiver-threading-profile maxThreadsActive="200"/> <dispatcher-threading-profile maxThreadsActive="200"/> </http:connector> <!-- 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"/> <endpoint name="LoanQuotes" address="jms://esb.loan.quotes" exchange-pattern="one-way"> <response> <object-to-string-transformer/> </response> </endpoint> <jms:endpoint name="CreditAgencyGateway" queue="esb.credit.agency" exchange-pattern="one-way"/> <!-- Here we're telling Mule to invoke a remote Ejb directly (not host a proxy service for the remote object as with the other example in loan-broker-esb-mule-config-with-ejb-container.xml) --> <ejb:endpoint name="CreditAgency" host="localhost" port="1099" object="local/CreditAgency" method="getCreditProfile" exchange-pattern="request-response"/> <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="one-way"> <cxf:jaxws-client serviceClass="org.mule.example.loanbroker.bank.BankService" operation="getLoanQuote" /> </endpoint> <endpoint name="Bank1In" address="http://localhost:10080/mule/TheBank1" exchange-pattern="one-way"> <cxf:jaxws-service serviceClass="org.mule.example.loanbroker.bank.BankService" /> </endpoint> <endpoint name="Bank2" address="http://localhost:20080/mule/TheBank2" exchange-pattern="one-way"> <cxf:jaxws-client serviceClass="org.mule.example.loanbroker.bank.BankService" operation="getLoanQuote" /> </endpoint> <endpoint name="Bank2In" address="http://localhost:20080/mule/TheBank2" exchange-pattern="one-way"> <cxf:jaxws-service serviceClass="org.mule.example.loanbroker.bank.BankService" /> </endpoint> <endpoint name="Bank3" address="http://localhost:30080/mule/TheBank3" exchange-pattern="one-way"> <cxf:jaxws-client serviceClass="org.mule.example.loanbroker.bank.BankService" operation="getLoanQuote" /> </endpoint> <endpoint name="Bank3In" address="http://localhost:30080/mule/TheBank3" exchange-pattern="one-way"> <cxf:jaxws-service serviceClass="org.mule.example.loanbroker.bank.BankService" /> </endpoint> <endpoint name="Bank4" address="http://localhost:40080/mule/TheBank4" exchange-pattern="one-way"> <cxf:jaxws-client serviceClass="org.mule.example.loanbroker.bank.BankService" operation="getLoanQuote" /> </endpoint> <endpoint name="Bank4In" address="http://localhost:40080/mule/TheBank4" exchange-pattern="one-way"> <cxf:jaxws-service serviceClass="org.mule.example.loanbroker.bank.BankService" /> </endpoint> <endpoint name="Bank5" address="http://localhost:50080/mule/TheBank5" exchange-pattern="one-way"> <cxf:jaxws-client serviceClass="org.mule.example.loanbroker.bank.BankService" operation="getLoanQuote" /> </endpoint> <endpoint name="Bank5In" address="http://localhost:50080/mule/TheBank5" exchange-pattern="one-way"> <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="30000"> <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> <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>