Mule Domain Project and Hybrid Deployment

What is Hybrid deployment?

  • With the hybrid deployment option, you can deploy your apps from the Runtime Manager cloud console to your Mule servers and use the Runtime Manager on CloudHub to manage them.
  • This option provides you with the flexibility and control over your on-premises security but requires you to provide the hosting infrastructure.
  • To use the hybrid option, you first register your Mule servers with the Runtime Manager agent. Then, from Runtime Manager, you can optionally add these servers to server groups or clusters to provide high availability. Finally, you can deploy your applications from the Runtime Manager to either a server, server group, or a cluster.
  • Mule Applications can be run on servers hosted on-premises or in the Cloud.

Why do we need Hybrid deployment?

  • Anypoint platform’s hybrid cloud functionality, built into the Mule Runtime architecture, allows organizations:
  1. To run the same APIs or applications across multiple cloud environments or on-premises.
  2. That cannot move to the cloud due to security or compliance reasons to run Mule apps on their own on-premises infrastructure without loss of functionality.
  3. To communicate with servers on their intranet from Mule applications without having to set up a VPC on CloudHub.
  4. Manage runtimes across a hybrid IT environment from a single management view.
  5. Move apps between cloud and on-premises environments without rewriting code.
  6. Utilize shared resources using domain project.
  7. Leverage existing load balancers for vanity domains.

What is Mule Domain Project?

  • A Mule Domain Project is implemented to configure the resources that are shared among different projects.
  • These resources can be used by all the projects associated with this domain.
  • Mule applications can be associated with only one domain, but a domain can be associated with multiple projects.

How can Mule Domain project help in a Hybrid deployment model?

  • When you deploy a Mule application with an HTTP Listener to a Mule runtime hosted on-premises, each application needs to be deployed on a different port, or you will get an error.
  • To avoid getting into an error situation, you can deploy a Domain project with an HTTP Listener connection. This Domain project can be referred by all the other applications in the same runtime, so you can run all the applications on the same default port (i.e., 8081) separated by paths. For example, you can have 2 REST APIs running on your on-premises Mule runtime with URLs like `` and ``


  • Defining flows, sub-flows, or any message processors as shared resources is not supported. Domains are not meant to share behaviour. They are meant to share resources only.

Mule Domain Project and Hybrid Deployment – Implementation Steps

A. Create a New Mule Domain Project:

To create a new Domain in Anypoint Studio:

  1. In the top menu bar, select File > New > Mule Domain Project. Picture 1
  2. Fill in the same fields as you would with a regular Mule Project: Picture 2

B. Configure Shared Resources by using the Global Elements Tab:

Configure shared resources by using the Global Elements tab in Anypoint Studio to first add a module to your domain project and then create a global element.

For example, to add Anypoint Connector for HTTP (HTTP Connector) to your domain project:

  1. In the Global Elements tab, click Manage Modules: Picture 4
  2. Click Add Module: Picture 5
  3. Search for the module you want to add and click Add >: Picture 6
  4. Click Finish.

C. Create Global Element:

After you add the HTTP connector to the domain project, you can create a global element to use as a shared resource:

  1. In the Global Elements tab, click Create: Picture 7
  2. Select the HTTP Connector and complete the configuration process: Picture 8
  3. Define the configurable parameters of your global element in the Global Element Properties window.

D. Associate a Mule App with a Domain Using Studio

To associate a Mule application with a Domain from Studio, follow these steps:

  1. In the Project Explorer or Package Explorer view, right-click the Mule application.
  2. In the menu that opens, click Properties.
  3. From Properties, click Mule Project.
  4. In the Domain field, select a domain for your project. Picture 9
  5. After completing these steps, Studio includes the domain in the pom.xml for your project
  6. In Studio’s visual editor, you can simply pick the shared resource out of the dropdown list in the Connector Configuration field of the connector’s properties editor: Picture 10

E. Deploying Domain Project in Mule on-premises Server:

The following steps describe how to deploy domain project and the Mule applications into a Mule on-premises Server.

  1. In Studio, select File > Export.
  2. Select Mule > Anypoint Studio Project to Mule Deployable Archive (includes Studio metadata).
This process creates a JAR file that you can deploy to a standalone Mule runtime engine. Picture 11
  3. Copy the exported domain’s JAR file to MULE_HOME/domains.
  4. The folder structure must look like this: Picture 12
  5. Export each Mule application that you want to deploy with the associated domain.
  6. Copy the exported JAR files for each Mule application that references the domain into the MULE_HOME/apps folder.
  7. Start Mule via the command console.
  8. When Mule starts, it first deploys any domains found in the MULE_HOME/domains folder, and then it deploys the Mule applications in the MULE_HOME/apps folder so that all domains are fully started before the Mule applications start.
Vertex Computer Systems is Hiring!Join the Team »