Getting Started with Mule

10 min read

(For more resources related to this topic, see here.)

Mule ESB is a lightweight Java programming language. Through ESB, you can integrate or communicate with multiple applications. Mule ESB enables easy integration of existing systems, regardless of the different technologies that the applications use, including JMS, web services, JDBC, and HTTP.

Understanding Mule concepts and terminologies

Enterprise Service Bus (ESB) is an application that gives access to other applications and services. Its main task is to be the messaging and integration backbone of an enterprise.

An ESB is a distributed middleware system to integrate different applications. All these applications communicate through the ESB. It consists of a set of service containers that integrate various types of applications. The containers are interconnected with a reliable messaging bus.

Getting ready

An ESB is used for integration using a service-oriented approach. Its main features are as follows:

  • Polling JMS
  • Message transformation and routing services
  • Tomcat hot deployment
  • Web service security

We often use the abbreviation, VETRO, to summarize the ESB functionality:

  • V– validate the schema validation
  • E– enrich
  • T– transform
  • R– route (either itinerary or content based)
  • O– operate (perform operations; they run at the backend)

Before introducing any ESB, developers and integrators must connect different applications in a point-to-point fashion.

How to do it…

After the introduction of an ESB, you just need to connect each application to the ESB so that every application can communicate with each other through the ESB. You can easily connect multiple applications through the ESB, as shown in the following diagram:

Need for the ESB

You can integrate different applications using ESB. Each application can communicate through ESB:

  • To integrate more than two or three services and/or applications
  • To integrate more applications, services, or technologies in the future
  • To use different communication protocols
  • To publish services for composition and consumption
  • For message transformation and routing


What is Mule ESB?

Mule ESB is a lightweight Java-based enterprise service bus and integration platform that allows developers and integrators to connect applications together quickly and easily, enabling them to exchange data. There are two editions of Mule ESB: Community and Enterprise. Mule ESB Enterprise is the enterprise-class version of Mule ESB, with additional features and capabilities that are ideal for clustering and performance tuning, DataMapper, and the SAP connector. Mule ESB Community and Enterprise editions are built on a common code base, so it is easy to upgrade from Mule ESB Community to Mule ESB Enterprise.

Mule ESB enables easy integration of existing systems, regardless of the different technologies that the applications use, including JMS, web services, JDBC, and HTTP. The key advantage of an ESB is that it allows different applications to communicate with each other by acting as a transit system for carrying data between applications within your enterprise or across the Internet. Mule ESB includes powerful capabilities that include the following:

  • Service creation and hosting: It exposes and hosts reusable services using Mule ESB as a lightweight service container
  • Service mediation: It shields services from message formats and protocols, separate business logic from messaging, and enables location-independent service calls
  • Message routing: It routes, filters, aggregates, and re-sequences messages based on content and rules
  • Data transformation: It exchanges data across varying formats and transport protocols

Mule ESB is lightweight but highly scalable, allowing you to start small and connect more applications over time. Mule provides a Java-based messaging framework. Mule manages all the interactions between applications and components transparently. Mule provides transformation, routing, filtering, Endpoint, and so on.

How it works…

When you examine how a message flows through Mule ESB, you can see that there are three layers in the architecture, which are listed as follows:

  • Application Layer
  • Integration Layer
  • Transport Layer

Likewise, there are three general types of tasks you can perform to configure and customize your Mule deployment. Refer to the following diagram:

The following list talks about Mule and its configuration:

  • Service component development: This involves developing or re-using the existing POJOs, which is a class with attributes and it generates the get and set methods, Cloud connectors, or Spring Beans that contain the business logic and will consume, process, or enrich messages.
  • Service orchestration: This involves configuring message processors, routers, transformers, and filters that provide the service mediation and orchestration capabilities required to allow composition of loosely coupled services using a Mule flow. New orchestration elements can be created also and dropped into your deployment.
  • Integration: A key requirement of service mediation is decoupling services from the underlying protocols. Mule provides transport methods to allow dispatching and receiving messages on different protocol connectors. These connectors are configured in the Mule configuration file and can be referenced from the orchestration layer. Mule supports many existing transport methods and all the popular communication protocols, but you may also develop a custom transport method if you need to extend Mule to support a particular legacy or proprietary system.

  • Spring beans: You can construct service components from Spring beans and define these Spring components through a configuration file. If you don’t have this file, you will need to define it manually in the Mule configuration file.
  • Agents: An agent is a service that is created in Mule Studio. When you start the server, an agent is created. When you stop the server, this agent will be destroyed.
  • Connectors: The Connector is a software component.
  • Global configuration: Global configuration is used to set the global properties and settings.
  • Global Endpoints: Global Endpoints can be used in the Global Elements tab. We can use the global properties’ element as many times in a flow as we want. For that, we must pass the global properties’ reference name.
  • Global message processor: A global message processor observes a message or modifies either a message or the message flow; examples include transformers and filters.
  • Transformers: A transformer converts data from one format to another. You can define them globally and use them in multiple flows.
  • Filters: Filters decide which Mule messages should be processed. Filters specify the conditions that must be met for a message to be routed to a service or continue progressing through a flow. There are several standard filters that come with Mule ESB, which you can use, or you can create your own filters.
  • Models: It is a logical grouping of services, which are created in Mule Studio. You can start and stop all the services inside a particular model.
  • Services: You can define one or more services that wrap your components (business logic) and configure Routers, Endpoints, transformers, and filters specifically for that service. Services are connected using Endpoints.
  • Endpoints: Services are connected using Endpoints. It is an object on which the services will receive (inbound) and send (outbound) messages.
  • Flow: Flow is used for a message processor to define a message flow between a source and a target.

Setting up the Mule IDE

The developers who were using Mule ESB over other technologies such as Liferay Portal, Alfresco ECM, or Activiti BPM can use Mule IDE in Eclipse without configuring the standalone Mule Studio in the existing environment. In recent times, MuleSoft ( only provides Mule Studio from Version 3.3 onwards, but not Mule IDE. If you are using the older version of Mule ESB, you can get Mule IDE separately from

Getting ready

To set Mule IDE, we need Java to be installed on the machine and its execution path should be set in an environment variable. We will now see how to set up Java on our machine.

  1. Firstly, download JDK 1.6 or a higher version from the following URL:
  2. In your Windows system, go to Start | Control Panel | System | Advanced.
  3. Click on Environment Variables under System Variables, find Path, and click on it.

  4. In the Edit window, modify the path by adding the location of the class to its value. If you do not have the item Path, you may select the option of adding a new variable and adding Path as the name and the location of the class as its value.

  5. Close the window, reopen the command prompt window, and run your Java code.

How to do it…

If you go with Eclipse, you have to download Mule IDE Standalone 3.3.

  1. Download Mule ESB 3.3 Community edition from the following URL: Unzip the downloaded file and set MULE_HOME as the environment variable.
  2. Download the latest version of Eclipse from

After installing Eclipse, you now have to integrate Mule IDE in the Eclipse. If you are using Eclipse Version 3.4 (Galileo), perform the following steps to install Mule IDE. If you are not using Version 3.4 (Galileo), the URL for downloading will be different.

  1. Open Eclipse IDE.
  2. Go to Help | Install New Software….

  3. Write the URL in the Work with: textbox: and press Enter.
  4. Select the Mule IDE checkbox.
  5. Click on the Next button.
  6. Read and accept the license agreement terms.
  7. Click on the Finish button.

    This will take some time. When it prompts for a restart, shut it down and restart Eclipse.

Mule configuration

After installing Mule IDE, you will now have to configure Mule in Eclipse. Perform the following steps:

  1. Open Eclipse IDE.
  2. Go to Window | Preferences.

  3. Select Mule, add the distribution folder mule as standalone 3.3; click on the Apply button and then on the OK button. This way you can configure Mule with Eclipse.

Installing Mule Studio

Mule Studio is a powerful, user-friendly Eclipse-based tool. Mule Studio has three main components: a package tree, a palette, and a canvas. Mule ESB easily creates flows as well as edits and tests them in a few minutes. Mule Studio is currently in public beta. It is based on drag-and-drop elements and supports two-way editing.

Getting ready

To install Mule Studio, download Mule Studio from

How to do it…

Unzip the Mule Studio folder. Set the environment variable for Mule Studio. While starting with Mule Studio, the config.xml file will be created automatically by Mule Studio.

The three main components of Mule Studio are as follows:

  • A package tree
  • A palette
  • A canvas

A package tree

A package tree contains the entire structure of your project. In the following screenshot, you can see the package explorer tree. In this package explorer tree, under src/main/java, you can store the custom Java class. You can create a graphical flow from src/main/resources.

In the app folder you can store the file. The folders src, main, and app contain the flow of XML files. The folders src, main, and test contain flow-related test files. The Mule-project.xml file contains the project’s metadata. You can edit the name, description, and server runtime version used for a specific project. JRE System Library contains the Java runtime libraries. Mule Runtime contains the Mule runtime libraries.

A palette

The second component is palette. The palette is the source for accessing Endpoints, components, transformers, and Cloud connectors. You can drag them from the palette and drop them onto the canvas in order to create flows. The palette typically displays buttons indicating the different types of Mule elements. You can view the content of each button by clicking on them. If you do not want to expand elements, click on the button again to hide the content.

A canvas

The third component is canvas; canvas is a graphical editor. In canvas you can create flows. The canvas provides a space that facilitates the arrangement of Studio components into Mule flows. In the canvas area you can configure each and every component, and you can add or remove components on the canvas.


Please enter your comment!
Please enter your name here