How can I share global elements between mule flows - mule

I'm starting out with mule and I noticed that the mflow files tend to get rather large and even if you use the visual view in Mule Studio it's hard to take it all in. I read somewhere that you could put each flow in a different file and then all the flows get deployed together and can call each other.
The problem now is I created my own custom transformer that I want to use in two different flows. But if I declare a global custom transformer in each file I get an error saying that the name already exists.
So now I tried and placed the custom transformer in its own mflow file and it works in runtime but the problem is Mule Studio doesn't seem to understand it at "compile time" and my mflow files are riddled with errors stating "Reference to unknown global element". How can I import global elements from one mflow file to another so that Mule Studio stops complaining.
Maybe this isn't the correct way to do it at all. If so I'd be happy to know how to achieve my goal in any other way.
Thanks in advance

This was a known issue with Studio whereby it doesn't recognise global elements in other config files but still runs the application fine: https://www.mulesoft.org/jira/browse/STUDIO-1881
This should be fixed in version 3.4 of Studio. What version of Studio are you using?
And yes, centralising reusable config elements is a common approach. More info on sustainable development with Mule here: http://www.mulesoft.org/documentation/display/current/Team+Development+with+Mule

Global Elements are accessible among all the mule flows, since Mule Studio 3.4

Related

Debugging an app with computed environment variables in IntelliJ IDEA

Consider an app which, in 12-factor style, receives its config in the form of a JSON document provided as an environment variable. The config contains secrets, so it is never stored on disk; instead, it is computed on the fly before starting the app, using something like sops or nunjucks.
I am trying to debug such an app in IntelliJ. Is there any way to run some arbitrary script before launch and provide its output to the app as an environment variable?
I will accept answers for any run config type, but an approach that works with "npm" or "Application" would be most helpful for me.
EnvFile IntelliJ IDEA plug-in added this option some time ago.
I did a quick test and don't see this option available, at least on Windows.
EDIT: found it was only merged in the forked version and not available in the official plug-in. You will have to merge it manually and build the plug-in from sources.
IntelliJ IDEA doesn't have a built-in feature for that, feel free to vote for the corresponding request.

Mule4 with Open JRE 11 - Adding additional file module-info.java?

I have downloaded fresh Mulesoft studio and changed configuration to point Open JRE- 11 and compiler to point 11.
Studio version - 7.8
When I try creating the mule project it is now also adding module-info.java along with mule.xml files.
Wonder why it is creating module-info.java I don't used to see when i was working with 1.8 version or before.
Any Idea ?? Thanks in advance.
Java 9 introduced a whole new level of encapsulation. Larger than packages, and more robust too. These are modules.
Chances are you should in the long term, migrate your project to use modules (for additional security, and for better code organization). However, the chances are also high that you won't want to do it right now, just because.
In that latter case, it would be reasonable to simply delete the module-info.java file. Provided you don't have any other module-info.java files in the system, and provided you run with everything on the classpath rather than module path (there's a good chance that's your default anyway) you should not have any problem.
Meanwhile, you have some homework to do, so you can decide if you will migrate to modules, and if so, how to do it.

Mule - Updating third party library in runtime

I'm using Mule Server 3.8 EE which brings commons-lang 2.4 with it. A third-party library in my project needs commons-lang 2.6, because it uses a method that was introduced in this version.
So when I just start my application, I get a java.lang.NoSuchMethodError
Is there a way to update the dependency in the runtime? What I tried so far:
including commons-lang 2.6 in my app -> no effect, the one from the runtime is picked up first
replacing the jar directly in the runtime -> errors in studio, that the 2.4 jar is missing
so maybe i am late BUT -- this is your answer. Add the libraries that are newer in the jar distribution to the Build Path. Under Java Build Path screen you should see the libraries listed. I needed to use Apache http-client 4.5.6 and that's very interesting because it brings with it a lot of other dependencies, so your question was VERY relevant. The solution is to rely on JAVA (and not mule -- oops Anypoint or whatever) conventions and make sure the JVM loads my class files first. Then, it won't load the old ones from mule's jar. And so I went to the tab Order and Export, and moved Mule to the bottom. This simple, trivial change makes it work. I think if we would work with command line and vim, we would all know this. But all the IDE gui and everything else makes us forget the simplest things. Please use it in good health. :)

Mule deployment - Invalid content found Data mapper config

I'm using the trial version of Mule Standalone EE server (checked the error message). I can run my project within Anypoint Studio, but when I deploy to Mule Standalone, it fails with the error - Invalid content was found starting with element 'data-mapper:config'
Anyone has any idea on this error?
I believe even I use Tomcat server, I would end up with same error or would it be using any other run time.
The Datamapper is not included in 3.7 anymore. So if you use it you must use the latest 3.6 runtime.
But still when deploying through Anypoint Studio, it should still work normally.
It says in 3.7 datamapper was replaced by another enterprise feature called DataWeave.
As per this reference :- http://forum.mulesoft.org/mulesoft/topics/developing-applications-using-mule-soft-community-ide-and-enterprise-ide-and-deploying-in-community-standalone-and-enterprise-standalone
also here :- https://developer.mulesoft.com/docs/display/EARLYACCESS/Including+the+DataMapper+Plugin
Thanks Anirban for the response. Found the resolution in second link you provided.
However the second link informs us to download the plugin zip, which I couldnt' find anywhere.
Instead, I searched in the Anypoint studio files and found data-mapper-plugin folder which I copied to MuleServer\Plugins location. And it worked.

Using MSTest with CruiseControl.NET

We have been using CruiseControl for quite a while with NUnit and NAnt. For a recent project we decided to use the testing framework that comes with Visual Studio, which so far has been adequate.
I'm attempting to get the solution running in CruiseControl. I've finally got the build itself to work; however, I have been unable to get any tests to show up in the CruiseControl interface despite adding custom build tasks and components designed to do just that. Does anyone have a definitive link out there to instructions on getting this set up?
Not sure if that helps (i found the ccnet Documentation somewhat unhelpful at times):
Using CruiseControl.NET with MSTest
The CC.Net interface is generated via an XSL transform on your XML files put together as specified in the ccnet.config file for your projects. The XSL is already written for things like FxCop - check your server's CC xsl directory for examples - shouldn't be too hard to write your own to add in the info - just remember to add the XML output from your tests into the main log.