Examples
The easiest way to start using Mule ESB is to walk through an example. Click a link below to learn how to get up and running with that example.
Running the Examples
The fastest approach is to run the examples from the command line. In this case, you will simply type the name of a batch script (such as hello for the Hello World example), and the example will run. Most of the examples can be run this way, but some require that you build them. See each example's page for details. Be sure you have completed all the instructions in Installing Mule before you attempt to run the example.
Building the Examples
There are two versions of each example that you can build: an Ant example, which just requires Ant 1.6.5 or later, and a Maven example, which requires Maven 2.0.9 or later and depends on the downloading of third-party JAR files. Follow all the instructions in Installing Mule to install Ant or Maven, set up your environment, install Mule, and populate the Maven repository (for Mule Enterprise users). To run an example in Eclipse, see Setting Up Eclipse for Use with Maven. Note that if you add Mule Enterprise features to an example and you are using Maven, you must add the correct [dependencies] to the POM before you rebuild the example.
Available Examples
| Example |
Description |
| Echo Example |
A simple example that demonstrates how to expose a service component over multiple transports. |
| Hello World Example |
Shows how to configure multiple service components to interact on a single request and how to manage event transformations. There is a good article on DevX that describes how to get started with Mule using the Hello World Example. There is also a Tutorial based on the Hello World example to help you get started with modifying a Mule application. |
| Stock Quote Example |
This example demonstrates how to invoke an ASPX web service from Mule, transform the result using XSLT, and deserialize the result to a StockQuote Java bean. The example demonstrates invoking the service using REST and SOAP. |
| Error Handler Example |
The error handler example demonstrates using Spring beans as Mule service component implementations and how to publish messages to multiple outbound endpoints. |
| Scripting Example |
Demonstrates Mule support for JSR-223 scripting. |
| Loan Broker Example |
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. |
| Mule Examples Webapp |
A web application that provides an interface to some of the examples, including LoanBroker, Hello World, and Echo. It also provides examples of accessing Mule using REST-style service calls and is itself an example of how to embed Mule in a web application. |
| Bookstore Example |
Demonstrates how to run Mule inside a webapp and how to build JAX-WS services with CXF. |
| JDBC Examples |
Demonstrate how to use the JDBC transport to read from and write to a database, including some features that are available only in the Mule Enterprise version of the transport. |
| WebSphere MQ Example |
(As of Mule Enterprise 2.2.3) Demonstrates using the Mule WMQ transport and JMS transactions. |
| WS-Security Example |
(As of Mule Enterprise 2.2.3) Demonstrates different possibilities available for incorporating WS-Security and/or SAML into your Mule application. |
Additional Mule Enterprise Examples
For additional Mule Enterprise examples, go to the Knowledge Base on the Customer Portal.