Access Keys:
Skip to content (Access Key - 0)
Cancel    
Cancel   
 

Mule Examples

Apr 22, 2014 19:08

Janet Revell

May 20, 2014 17:29

Mulesoft Current Mule Documentation

Mule Examples

Mulesoft Documentation Page

Contents

Mule Examples

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

 Contents

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.
    ComplexityExample AppKey ConceptsIncluded in Runtime
    CommunityEnterprise

    Low

    Hello WorldInteracts with an end user via an HTTP request.

    LowHTTP Request-Response with LoggerLogs activity in an application.

    MediumWeb Service ConsumerConsumes a SOAP Web service. 
    MediumConnect with SalesforceFacilitates communication between a file-based system and Salesforce. 
    MediumSalesforce to Database

    Synchronizes data between Salesforce and a database using Batch processing.

     

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

    MediumForeach Processing and Choice Routing

    Dynamically applies routing criteria to a message at runtime.

    Processes collections iteratively without losing any of the payload.

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

    MediumWebsphere MQFacilitates message processing between Mule and WMQ.  

    MediumREST API with APIkitImplements a REST API with a RAML interface.
    HighXML-only SOAP Web Service

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

    Dynamically applies routing criteria to a message at runtime.

     

    HighSOAP Web Service SecurityImplements application-layer security on a SOAP Web service. 

    HighService Orchestration and Choice Routing

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

    Dynamically applies routing criteria to a message at runtime.

    Processes collections iteratively without losing any of the payload.

    Caches message content during processing to reuse frequently called data.

     

    The examples included with Mule Standalone persist from Mule 3.3.X. Therefore, the documentation for these examples resides within Mule 33X Documentation.

    ComplexityExample AppKey ConceptsIncluded in Runtime
    CommunityEnterprise

    Low

    helloInteracts with an end user via an HTTP request.

    LowechoLogs activity in an application.
    LowgpswalkerUses AJAX to communicate from a Mule to a Web browser.
    Lowloanbroker-simple

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

    Lowscripting

    Invokes a JSR-223 script from Mule.

     Dynamically applies routing criteria to a message at runtime.

    Uses JVM environment variables.

    MediumforeachProcesses collections iteratively without losing any of the payload.
    Mediumbookstore  Exposes a Web service using Jetty and CXF.
    Mediumstockquote

    Invokes an ASPX Web service from Mule.

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

    MediumwmqFacilitates message processing between Mule and WMQ.  
    Highflight-reservation

    Processes collections iteratively without losing any of the payload.

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

    Highjdbc

    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

     
    HighsecurityImplements application-layer security on a SOAP Web service. 

    Create and Run Example Applications

      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 Project wizard, click to select a Runtime, then click to select a Template.

         

        How do I get Mule Community runtime?

      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!

      2. To stop the application from running, click the red Terminate button in Studio's Console.

      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. 

        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?
        1. Open a new command line.
          Windows: Open the Console.
          Mac: Open the Terminal application (Applications > Utilities > Terminal).
        2. Access the directory in which your Mule instance is installed. For example, type cd /Users/aaron/Downloads/mule-standalone-3.5.0/
        3. 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.

       

      Go Further