Introduction about Mule Domain Project in Mule ESB

When working with Mule ESB, it’s likely that you will have multiple Mule applications using the same resource. For example, you have several Mule applications that are related, deployed to the same server, and some of these applications use the HTTP Listener Connector with the same host and port. So how to solve this problem? Mule Domain Project is a solution for you! In this tutorial, let’s learn about the Mule Domain Project in Mule ESB.

Mule Domain Project in Mule ESB is a project that contains common resources between Mule applications. Instead, globally Connectors are only used in multiple flows of the same Mule application, which can now be used in other Mule applications.

Every Mule application has its own domain. If you open the mule-deploy.properties file in any Mule project, you will see that we have a domain property named default.

This is the default domain of the Mule application. This means that each Mule application has its own domain and does not share any of its resources.

OK, now we will try to create a new Mule Domain Project and a normal Mule Project in Anypoint Studio as an example of how to use the Mule Domain Project. You can refer to how to create a new Mule Domain Project here and the Mule Project here.

Let’s say I created 2 Mule Projects in my workspace as follows:

Introduction about Mule Domain Project in Mule ESB

In it, mule-esb-domain-project is the Mule Domain Project and mule-esb-helloworld is a Mule application that has a flow with an HTTP Listener Connector with a Logger Component as follows:

Introduction about Mule Domain Project in Mule ESB

This flow will receive a request with the parameter name, which will allow us to print out the value of this parameter name using the Logger Component.

As you know, to configure the HTTP Listener Connector we have a section called General Settings that will point to the configuration for the host and port.

We will now move this configuration to the mule-domain-config.xml file in our Mule Domain Project, mule-esb-domain-project.

The contents of the mule-domain-config.xml file should now look like this:

To enable our mule-esb-hello-world project using the Mule Domain Project, open the mule-project.xml file in this project and edit the Domain section as follows:

Introduction about Mule Domain Project in Mule ESB

At this time, our mule-esb-helloworld project will look like this:

Introduction about Mule Domain Project in Mule ESB

Now, running the mule-esb-helloworld project, you will see the following result:

That is so successful.

Now, if you request to the application with http://localhost:8081/hello?name=Khanh, the console will print the log as follows:

 

One thought on “Introduction about Mule Domain Project in Mule ESB

  1. Can you please let me know how we can config the *.properties files with domain project.As i was using TLS password etc from this file and i want use other variable from this file.
    AM using this project with out maven.

Add Comment