Using Domain Project

DZone 's Guide to

Using Domain Project

Let's check out how to consume a custom domain project we created. In other words, explore how to attach a Mule application to our previously defined domain.

· Integration Zone ·
Free Resource

In my previous article, I described how to create a custom domain project. This time, we will try to consume that. In other words, we will attach a Mule application to our previously defined domain.


Just to recap, let's see what our domain looks like. We have a profit-domain project with global configuration and one yaml file. We also have embedded dependencies to HTTP, JMS, and Sockets modules. As a result, all connected applications should have the same global configuration and basic modules like in the diagram below.

Domain Project

When we have domain project in place, it is time to link it with our project. Those of you familiar with Mule 3 will find the first change in the new release. There is no longer a mule-project.xml file, which is where we used to set it up.

You need to click on the project name and, from the drop-down menu, select Properties. Then, you need to navigate to Mule Project. You can select your domain project from the drop-down menu next to Domain property like in the diagram below.

Mule Project settings

In my sample application, order-app, I have selected a domain called profit-domain. As the domain is already linked with runtime, Server Runtime property has been grayed out but filled with the correct Runtime from the domain.

Click Apply and Close, and that is all.

Existing Modules: When you decide to share common set of Mule modules in the domain project, you may face an "existing modules" problem. In the moment you choose your domain project, like described above, you will see a notice with a warning icon. The text is as follows: "Existing modules conflicts with domain. Go to Problems view for more details." You may be tempted just to ignore it. With this warning, you won't be able to build a project. Bear that in mind.

Configuration Usage

From now on, you may link to global configuration elements from your flows. Anypoint Studio will auto-populate appropriate drop-down lists. Access to global properties from yaml file is the same as if it was in the current project like ${property.name}


By now, you should know how to increase your code quality by sharing common configuration and properties using domain project. You are aware that you could also share a functionality and awesome DataWeave functions that you have created. In order to do this, you use a custom maven project — this is described in this article.

If you have any interesting ideas about sharing/reusing or anything related to the project quality, feel free to share it.

consume a domain ,integration ,mule ,tutorial

Published at DZone with permission of Patryk Bandurski , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}