Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Optimize Resource Utilization with Mule Shared Resources

DZone's Guide to

Optimize Resource Utilization with Mule Shared Resources

· Integration Zone
Free Resource

Learn how API management supports better integration in Achieving Enterprise Agility with Microservices and API Management, brought to you in partnership with 3scale

[This article originally written by Pablo La Greca.]

In 3.5 we introduced the concept of domains in the Mule container. You can now set up a domain and associate your Mule applications with a domain. Within a domain project you can define a set of resources (and the libraries required by those resources) to share between the applications that belong to the domain.

Within the mule-domain-config.xml you can define a JMS broker connector that can be reused by all the Mule applications that belong to that domain.

This way, you can share a jms caching connection factory and reuse jms client resources with the consequent optimization of resource consumption.

How to deploy a domain in Mule

Once you have your domain fully configured, you need to deploy it in Mule. You deploy domains in the same manner you deploy Mule applications, but using the domains folder. You can create a zip file with the domain folder content or just move the domain folder to the domains folder.

Using domain level resources from within an application

Now that we have our domain defined you can use the resources defined in that domain from your applications. To do that you need to specify in your Mule application what domain you want to use. You can only use one domain per application and you just need to specify a the domain in the application’s Mule-deploy.properties file.

Then, in the mule application you can start using the shared resources declared by the domain.

As you can see in the application configuration file we are using the jms connector sharedJmsConnector declared in the domain.

Tips & Tricks

  • By sharing a VM Connector you can consume services exposed by one Mule application from another Mule application that belongs to the same domain. This is the most performant way of consuming internal services.

  • Sharing an HTTP connector allows you to use the same port from several applications.

  • If there’s only one connector defined for a particular transport in the combination of the domain config and the app config files then you don’t need to reference them explicitly using connector-ref.

Mule ESB keeps growing and with domains we become a complete container for applications. Sharing resources is really simple and easy to use since it uses standard Mule configuration. There is no need to learn a new syntax.

There are several companies using Mule and deploying hundreds of applications within a single Mule container. With shared resources you can optimize the use of connections to jms brokers and databases or decrease the number of ports in your firewall. You can even create better service reutilization with shared VM queues.

This is only the beginning. We expect to increase the components that you can share between applications in later releases.

Want to learn more?

If you want to learn more about this feature you can take a look at the early access documentation for 3.5.0 or take a look at the maven archetypes and plugins that we provide to simplify domain creation.

Unleash the power of your APIs with future-proof API management - Create your account and start your free trial today, brought to you in partnership with 3scale.

Topics:

Published at DZone with permission of Ross Mason, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}