It’s been some time since my last blog on Anypoint Code Builder, so today I'll be guiding you through the most recent changes that have been made to it. The latest release was in June, and to say it was a big one is an understatement!
Here is a list of things that were included in the latest release:
- DataWeave Expression Builder
- Component configuration enhancements
- Support for multiple Mule runtime versions with Java 17 or 11
- Custom Java classes and code
- Maven settings
- MUnit support
- API Governance for REST API
For today, I'll walk you through the first four features - stay tuned, because I'll be covering the rest in part two.
Let’s start with the first one!
DataWeave Expression Builder
It is now possible to build expressions using DataWeave using UI, for the components that accept expressions (fx fields). The feature provide panels for:
- Data – to select a value,
- Functions – list of DataWeave functions to be used,
- Preview – to run the functions on the sample data.
As an example, let's take a look at the ‘Hello World’ project we've used in previous blogs. As demonstrated in the image below, there are the three mentioned panels. From the functions list, I selected function upper() which capitalises the supplied string.
Now, in the preview panel, we can see the result of the selected function.
Component configuration enhancements
If we check the UI for the components, we can see two new additions – Input and Output tabs. Using these, we can view Mule event metadata from the payload, attributes, and Mule variables.
Here we can see the Input tab:
And the Output tab:
Support for multiple Mule runtime versions with Java 17 or 11
Anypoint Code Builder now supports Mule Java 11 and 11 versions and following runtime versions 4.4, 4.6, and 4.7. It is also possible to select runtime and Java versions when creating a project, as seen below:
Custom Java classes and code
The new release includes support for Java code. Now, we have the ability to use Java classes directly from Anypoint Code Builder. To continue with our example, I've created a simple Java class and placed it under src/main/java.
To use it in our code, I utilised the "Invoke Static" component. The class name was pre-populated, and I selected the function from the drop-down list.
Next time
In the next part of this blog, I will cover the remaining three functionalities: Maven Settings, MUnit Support, and API Governance for REST APIs. Stay tuned!