Upgrade your Groovy Scripts in Mule with DSLDs

The groovy script transformer component is a very powerful piece of Mule. I use it for almost every message transformation that I need to make. Its XML and JSON libraries reduce message format conversion down to little more than building a map, while closures give you some powerful processing tools for handling complex data structures.

I’ve discovered a way to give these scripts a little extra integration into Eclipse (and therefore Anypoint Studio). Groovy scripts come with standard script properties like ‘flowVars’, ‘sessionVars’ and ‘message’. However, Anypoint Studio doesn’t have the info required to know what type these properties are, so code completion doesn’t work with them. The good news is that DSLDs (a little talked about feature that comes as a part of the Groovy plugin in Eclipse) are designed for just this particular problem.

To make these files work for you, you’ll need to install the Groovy Eclipse plugin in Anypoint Studio, and enable the Groovy nature on your project (Right click -> Configure -> Convert to Groovy Project).

Once that’s done, simply include the below file in your project somewhere (it doesn’t have to be on the build path) and Anypoint Studio should start using it as a part of your code completion in groovy scripts.

So here is a DSLD that will give you code completion for the standard Groovy script properties. You might find it useful to customise it for your own scripts as well. Further details about these standard properties can be found in the Mule documentation.


You might also enjoy:

Developing Bulk APIs with Mule, RAML and APIKit 02 December 2014

Data Mapping with Groovy - Part 2 02 December 2013

Dock Tales: Docker Authoring, with Special Guest Mule ESB 30 March 2015

Ansible Crash Course 09 March 2016

Advanced File Handling in Mule 15 June 2015


comments powered by Disqus