DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • While Performing Dependency Selection, I Avoid the Loss Of Sleep From Node.js Libraries' Dangers
  • Understanding ldd: The Linux Dynamic Dependency Explorer
  • Why You Don’t Need That New JavaScript Library
  • Why Use AWS Lambda Layers? Advantages and Considerations

Trending

  • How to Use AWS Aurora Database for a Retail Point of Sale (POS) Transaction System
  • Apache Spark 4.0: Transforming Big Data Analytics to the Next Level
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • How GitHub Copilot Helps You Write More Secure Code
  1. DZone
  2. Software Design and Architecture
  3. Security
  4. Import Mule Application as Project Libraries For Shared Resources

Import Mule Application as Project Libraries For Shared Resources

How to import one Mule application A into another Mule application B to utilize its shared resources as project libraries by adding it as maven dependencies.

By 
Rukhsar Praveen user avatar
Rukhsar Praveen
·
Sep. 18, 20 · Tutorial
Likes (5)
Comment
Save
Tweet
Share
18.4K Views

Join the DZone community and get the full member experience.

Join For Free

Use Case: If we want to use shared resources or common global configuration from one of Mule application into another Mule application then this article could guide us to achieve this use case.

In Mule 4, Anypoint Studio’s built-in Maven support for any Mule Projects has provided a great feature where any Mule applications can be packaged into a deployable JAR file. This package contains the application and all its dependencies. It can be used as JAR file or as a mule plugin.We can also used it as a utility application referencing through project libraries. In our use case we are going to use one Mule application as utility application into another Mule application.

Note: We have a concept called Mule Domain Project for same use case where we can defined common global configuration to be shared among other applications. But there is one impact of Mule Domain Project that it need to be deployed under same domain and in cloudhub we dont have support for it as each Mule application deployed into their own Mule runtime. It would not be possible to use a domain to share anything because domain can only share resources in the same runtime.

Mule Application

Step 1

  • Create a Mule project named as common-configuration-property and define properties values through property file in key-value pair. It can be define through .YAML or .properties file under src/main/resource mule project directory


 

  • The properties file ( prop-config.yaml) must be declared or get loaded through declaring it in configuration property inside Global elements.

 

  • If developers want to shared any common resources to the multiple project then we can declare it through creating respective configuration in Global elements.

 For ex: create a http listener configuration and provide a unique name to it .Also we can define JMS or Database or any endpoint configuration as shared resources.


  • Deploy the common-property-configuration application. After successful deployment just export as Mule project.


 

Step 2

  • Now we can create a test demo project to utilize the shared resources and common property configurations. For this we need to import common-property-configuration.jar into demo project as maven dependency.

Follow the steps specified below to add the .jar file as a maven dependency :-


 

 

  • The next pop-up window will ask us to browse the .jar file to install it into our local repository. 

 


  • Click install and finish adding it as maven dependency. The .jar will be successfully installed in our local repository. To verify that we can check .m2 folder in respective groupId.

 


  • We can refresh the project and can check pom.xml ,the dependency of common-property-conifuation.jar will be added automatically.


 

  • We can also check project libraries to verify the if the jar is added under libraries to refer to common-property-conifuation application.


 


  • Before creating any sample flow , we can declare the utility application file by using Import configuration inside Global elements to references the files with all the configurations to import. The files will be loaded from the classpath of the artifact. With this we can reference to any common flows and configurations which we can utilize or access as shared resources. We can import multiple files.

 

Sample Flow In Application B:

We can create a simple flow by using http listener and a logger.

When we drop down the http listener connector configuration we can see the configuration of http listener from shared resources application is accessible and there no need to declare the manual configuration of http listener in Global elements.

 


In logger we can simply define the http.port property in message to print the propery value from common shared resource application .



Deploy and test:- 

 



We can deploy this project into cloudhub:



Triggered the Request:-

Test Result:-


Note:- As the application B contains snapshot dependencies so if there would be any change in the dependency may not impact in the cloudhub deployed application. Need to update the dependency and restart.

application Library Dependency

Opinions expressed by DZone contributors are their own.

Related

  • While Performing Dependency Selection, I Avoid the Loss Of Sleep From Node.js Libraries' Dangers
  • Understanding ldd: The Linux Dynamic Dependency Explorer
  • Why You Don’t Need That New JavaScript Library
  • Why Use AWS Lambda Layers? Advantages and Considerations

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!