This page last changed on Oct 02, 2006 by lajos@mulesource.com.

The Loan Broker example application is based on the example presented in the Enterprise Integration Patterns book. This chapter of the book is available online so you can see a detailed description of the application here.

The example uses synchronous execution model using soap, meaning that it makes each request from the Loan Broker object and blocks until the result is received before making the next request. There are two flavours of the Mule Loan broker -

  1. Synchronous Loan Broker - The behaviour of this Loan Broker is analogous to the example in Enterprise Integration Patterns.
  2. Asynchronous Loan Broker - Executes requests asynchronously with Mule handling all interactions between the components.

Running the Loan Broker

Prerequisites

To run you will need the following -

Optional

  • If you are asked to execute any Maven commands you'll need the Maven build tool from Apache. Mule has been tested with Maven 1.0.2. (Download Maven 1.0.2)

Running

  1. Open up a shell*
  2. go to the root of the distribution, then go to examples/ant/loanbroker or examples/maven/loanbroker.
  3. run the 'loanbroker.sh' or 'loanbroker.bat' script.
  4. You'll be prompted to select a SOAP stack, either Axis or XFire. Type 'a' (for Axis) and hit return.
  5. You'll be prompted as to whether you want to run the Asynchronous or synchronous version. Type 's' and hit return.
  6. You'll be prompted with a selection menu, select 2 to send 100 random requests.
  7. You'll see a lot of output on screen, you just made 100 loan requests!
  8.  

If you have checked out the source code you can run the Loan Broker using maven. At the samples project root in a shell type -

maven mule:loanbroker

-
*Shell refers to a command shell in unix or linux and command prompt in windows.

What next

Now you have run the example here is some more detail about what it does. There are 4 main components-

  1. Loan Broker - Receives requests and initiates the calls to other components
  2. Credit Agency Service - Retrieves credit information about the customer
  3. Lender Service - determines which banks to request quotes from depending on the customer credit history
  4. The Banks - There are 5 banks all listening on separate soap servers that provide Loan quotes

Asynchronous Loan Broker

The asynchronous Loan Broker is configured so that each component receives a request, processes it and then forwards the results asynchronous and Mule manages the delivery of events between the components.

Cannot resolve external resource into attachment.

The asynchronous sample demonstrates the following features-

  • Using asynchronous point-to-point routing beetween the Loan Broker to the Credit Agency, then to the Lender Service.
  • The Lender service Uses the Recipient List router to make requests to a number of banks
  • The Lender service also Uses the event replyTo property to route replies from the various banks back to the Loan Broker.
  • The Loan Broker Uses the Correlation aggregator Router to receive the replies and only route the
    quote with the lowest rate.
  • The loan broker receives two types of event, a Loan Request and a Loan Quote and the Inbound router is configured to determine how each type of event is routed.
  • The Mule soap provider is used as the communication channel between the components and the VM provider is used on the replyTo from the banks to the Loan Broker.

Synchronous Loan Broker

The synchronous loan broker makes each request from the Broker itself in a synchronous manner

Cannot resolve external resource into attachment.

The synchronous sample demonstrates the following features-

  • Using synchronous point-to-point routing beetween the Loan Broker to the Credit Agency and Lender Service.
  • The Loan Broker uses the EventContext to manage event flow programmatically.
  • The Loan Broker uses the Recipient List router to make requests to a number of banks
  • The Lender service also Uses the event replyTo property to route replies from the various banks back to the Loan Broker.
  • The Loan Broker uses an outbound router to determine how the event is routed based on type or property settings.
  • The Mule soap provider is used as the communication channel between the components.

Mule Config Graphs for the Loan Broker Examples

This is a configuration graph generated for the Loan broker examples using the Mule Config Graph Tool.
(Click on the thumb images for a bigger picture)

Synchronous Configuration

Asynchronous Configuration


Document generated by Confluence on Oct 03, 2006 09:23