Last Updated on 05/05/2021 by Patryk Bandurski
In the previous article, I have described how to create a custom Mule Domain Project. This time we will try to consume that. In other words, we will attach the Mule application to our previously defined domain.
Link
Just to recap. Let us see how our domain looks like. We have a mydomain project with global configuration and one yaml file. We have also embedded dependencies to HTTP, JMS modules. As a result, all connected applications should have the same global configuration and basic modules. Like in the diagram below.
When we have a 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. As there is no longer a mule-project.xml file, 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 the Domain property. Like in the diagram below.
In my sample application, Order SAPI, I have selected a domain called mydomain. As the domain is already linked with runtime, the Server Runtime property has been grayed out. You can see value taken from the Mule Domain Project. In my case, this is Mule Server 4.3.0 EE.
Click Apply and Close and that is all.
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}
Summary
By now you should know how to increase your code quality by sharing common configurations and properties using the domain project. You are aware that you could share also the 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 project quality feel free to share it :).
It would be awesome if you could include the solution for the existing modules issue