Contact Us 1-800-596-4880

Mule Examples

Mule Runtime Engine versions 3.5, 3.6, and 3.7 reached End of Life on or before January 25, 2020. For more information, contact your Customer Success Manager to determine how you can migrate to the latest Mule version.

Mule provides a suite of example materials to help you learn more about building applications in Anypoint™ Studio and Mule ESB Standalone.

Template Applications

Mule templates offer pre-packaged solutions to common integration scenarios, you may barely need to add your user credentials to the project’s configuration files for them to be ready to deploy.

Example Applications

Mule example applications offer insight into how you can use Mule to manage system connection and integration situations. Based on real-life business use cases, the examples demonstrate Mule’s features and functionality and suggest how you can take advantage of them.

  • In Anypoint Studio, Mule’s graphical interface, a set of example applications exist in the form of example templates which you can use to build a Mule application without having to start from scratch.

  • In Mule ESB Standalone, (Mule without Studio) a different set of example applications exist as files in the examples folder of the product distribution. You can access these example applications from your computer’s console, using them as foundations upon which to build your own apps.

Studio

Complexity

Example App

Key Concepts

Included in Runtime

Community

Enterprise

Low

Hello World

icon world blue bigInteracts with an end user via an HTTP request.

Low

HTTP Request-Response with Logger

loggingLogs activity in an application.

Medium

Web Service Consumer

consumeAPIConsumes a SOAP Web service.

Medium

Connect with Salesforce

cloud_iconFacilitates communication between a file-based system and Salesforce.

Medium

Salesforce to Database

batchSynchronizes data between Salesforce and a database using Batch processing.

Medium

Legacy Modernization

legacy_modern_iconActs as a Web service proxy for a legacy, file-based system.

Medium

Foreach Processing and Choice Routing

content_routingDynamically applies routing criteria to a message at runtime.

iteration2Processes collections iteratively without losing any of the payload.

enriched4Enriches message payloads with data, rather than changing payload contents.

Medium

Websphere MQ

wmqFacilitates message processing between Mule and WMQ.

Medium

REST API with APIkit

Implements a REST API with a RAML interface.

High

XML-only SOAP Web Service

orchestrateOrchestrates a sequence of calls to other services or message queues.

content_routingDynamically applies routing criteria to a message at runtime.

High

SOAP Web Service Security

icon lock blue bigImplements application-layer security on a SOAP Web service.

High

Service Orchestration and Choice Routing

orchestrateOrchestrates a sequence of calls to other services or message queues.

content_routingDynamically applies routing criteria to a message at runtime.

iteration2Processes collections iteratively without losing any of the payload.

cache_iconCaches message content during processing to reuse frequently called data.

Standalone

Complexity

Example App

Key Concepts

Included in Runtime

Community

Enterprise

Low

hello

icon world blue bigInteracts with an end user via an HTTP request.

Low

echo

loggingLogs activity in an application.

Low

gpswalker

Uses AJAX to communicate from a Mule to a Web browser.

Low

loanbroker-simple

Uses the simple-service configuration pattern, transformers and filters with Groovy scripting, and CXF clients and services.

Low

scripting

Invokes a JSR-223 script from Mule.

content_routingDynamically applies routing criteria to a message at runtime.

Uses JVM environment variables.

Medium

foreach

iteration2Processes collections iteratively without losing any of the payload.

Medium

bookstore

icon world blue bigExposes a Web service using Jetty and CXF.

Medium

stockquote

Invokes an ASPX Web service from Mule.

orchestrateOrchestrates a sequence of calls to other services or message queues.

Medium

wmq

wmqFacilitates message processing between Mule and WMQ.

High

flight-reservation

iteration2Processes collections iteratively without losing any of the payload.

orchestrateOrchestrates a sequence of calls to other services or message queues.

High

jdbc

Uses JDBC endpoints and SQL queries together to manipulate data.

Sets properties on messages and parses and transforms message payload data.

Handles errors with a customized exception strategy

High

security

icon lock blue bigImplements application-layer security on a SOAP Web service.

Old Examples

What happened to the old examples from previous versions of Studio?

They haven’t disappeared!

Click the links below to download deprecated examples:

Mule Community Examples

Mule Enterprise Examples

Create and Run Example Applications

Studio

Create

  1. If you haven’t already done so, visit www.mulesoft.org and download Mule ESB with Anypoint Studio for free. Follow the instructions on the website to launch Anypoint Studio and select a workspace.

  2. Click the File menu, then select New > Mule Example Project.

  3. In the New Mule Example Projec*t wizard, click to select a *Runtime, then click to select a Template.

    NewExample
  4. Adjust the Project Name, if you wish, then click Finish to open the new example project, complete with pre-built and pre-configured flows.

Run

  1. In the Package Explorer pane in Studio, right-click the project name, then select Run As > Mule Application. Studio runs the application and Mule is up and kicking!

    **********************************************************************
    * Application: projecttotest                                         *
    * OS encoding: MacRoman, Mule encoding: UTF-8                        *
    *                                                                    *
    * Agents Running:                                                    *
    *   DevKit Extension Information                                     *
    *   Clustering Agent                                                 *
    *   JMX Agent                                                        *
    **********************************************************************
    INFO  2013-04-09 13:08:36,099 [main] org.mule.module.launcher.MuleDeploymentService:
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    + Started app 'projecttotest'                              +
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. To stop the application from running, click the red Terminate button in Studio’s Console.

    image::terminate.png[]

Standalone

Create

  1. If you haven’t already done so, download the Mule ESB standalone Community Runtime for free. (Scroll down to the table below the main portion of the page for the Standalone Community runtime. (Alternatively, download a trial version of Mule ESB Enterprise (with Management Tools).

  2. Navigate to the folder on your local drive that contains your copy of Mule ESB Standalone runtime.

  3. Locate the Examples folder, then the folder for the example you wish to run.

  4. Copy the pre-built application archive (the .zip file) for the example.

  5. Paste the copy of the .zip file into $MULE_HOME/apps.
    For example, to run the Hello World example, copy mule-example-hello-3.5.0.zip then move the copy to the $MULE_HOME/apps folder.

    examplespath

    Alternatively, you can build the example in a build tool such as Ant or Maven.

    1. Run ant or mvn in your Ant or Maven build tool, respectively.

    2. The build tool compiles the example classes, produces an application zip file and copies it to your $MULE_HOME/apps folder.

  6. Start Mule.

    Need more detail? .. Open a new command line. Windows: Open the Console. Mac: Open the Terminal application (Applications > Utilities > Terminal). .. Access the directory in which your Mule instance is installed. For example, type cd /Users/aaron/Downloads/mule-standalone-3.5.0/ .. To start Mule, type ./bin/mule

  7. After it starts, Mule polls the apps folder every 5 seconds; it picks up the application you copied to the apps folder, then deploys it automatically. In the first command line, Mule notifies you that it has deployed the example application.

  8. To stop Mule, hit CTRL-C.

See Also