Training Talks: How to Copy Global Elements into a Mule Domain Project

August 2 2017

0 comments 0
training talks

Our favorite drummer/instructor is back with a new edition of Training Talks! In this demo, Ethan will show you how to copy over global configuration elements from a Mule application into a Mule domain project, including copying over the namespace and the schema location definitions for those global configuration elements, including the HTTP and VM queue connector.

Demo Video 

Instructions

Follow Ethan’s demo by watching the video above and reading the instructions below:

To get started, we’re going to open Anypoint Studio with a new work space, and we’re going to create a new project. In Anypoint Studio, there are no defined global elements, and we can see the default set of namespaces and schema locations that occur with a brand new Mule project.

If we go to the Mule application, and bring in some new connectors, like an HTTP connector and a VM queue, then we need to specify a global element for the HTTP connector. We can do this by configuring the new global element and setting it to default.

We can then see that global element is defined, which, in turn, defines a new HTTP listener and automatically brings in the schema location for the new namespace.

In this case, we see that both the HTTP namespace and the VM queue namespace have been added. And if, for example, we configure the VM with a new connector, we will see that the VM connector also has a new schema location and a new namespace.

Let us compare this to what happens when we create a new domain project. If we create a new Mule domain project instead, then we can see that there’s a namespace for the domain project that has already been defined. This is something that’s not in a regular project, but there’s no way for us to visually add an HTTP connector.

Instead, we need to copy them from an existing project. So we have the project over here, and so let’s say we want to take these two global configuration elements. We then can paste them; at which point we will get errors related to the namespace.

The first error says that there’s no prefix HTTP for this element. We need to add the namespace. So we go back over here, and we take the namespace element,. We should do it for both for HTTP and for the VM queue. If we paste those over into the domain project, then we’re going to see a different error related to the schema location.

To resolve this error, we need to also copy over the schema location. If we look carefully, we can see the schema location for the HTTP global element as well as the schema location for the VM endpoint. I’m going to copy and paste those additional schema locations, add those in, and now we see that the error is gone.

For the next step, we take this project and add it to the domain. And now, this project has access to the global configuration elements that are defined in the domain.

We can actually cut these global configuration elements out, and that’s okay because the HTTP listener configuration and the VM configurations are already defined in the domain project. As long as we have made these configurations part of that domain, we won’t get an error.

However, if we change this back to the default domain, we will get errors saying that there’s no configuration. If we switch back to the shared domain project, then we will see that there are no errors.

And that’s it for this demo! By following these steps, you will be able to create new domain projects, and then share those global configuration elements with other applications.

Have questions for the Training team? Drop it in our forum or Training Twitter using the hashtag #TrainingTalks and stay tuned!

Learn more about our available courses and certifications by visiting our training site.


 


We'd love to hear your opinion on this post