What's New in Mule 4
What's New in Mule 4
The upcoming Mule version 4 adds useful features like a message transformer, simplified connectors, a Mule API, and more.
Join the DZone community and get the full member experience.Join For Free
The State of API Integration 2018: Get Cloud Elements’ report for the most comprehensive breakdown of the API integration industry’s past, present, and future.
Mule is going to release version 4 soon. Here are some of the important features that will ease development, which will be available in Mule 4:
In Mule 3, when we use DW and transform messages, we need to explicitly convert the message to a Java object so that the output can be used in Router components, For Each, etc. In Mule 4, you don't need to explicitly convert messages to Java objects. Mule 4 will do it automatically for you.
The File, FTP, JMS, and VM connectors have been updated. The connectors have been made operation based to, for example, create directories/files. Mule 4 has a connector named File-Create Directory, to write files and directories.
Error handling has been modified significantly in Mule 4. In Mule 3, Error handling is Java based, but in Mule 4, Java exceptions are optional. The biggest improvement is that one can catch an exception of some specific block of components (TIBCO has this feature) instead of a centralized exception block. And the exceptions can be re-propagated.
As shown in the diagram below, we can handle the exceptions of some component/s in the same main flow:
Also, exceptions can be chosen from the dropdown list:
Anypoint Studio 7
The Studio has been improved a lot. The following new features have been added to the Studio:
The palettes have new icons.
Now one can save their favorite palettes.
Deeper Maven integration.
One can right click on a palette and go directly to its XML configuration.
The flows are collapsible.
Some new dev tools have been added in Mule 4. One of them is Design Center. It is targeted to the less technical Mule users. Design Center is a web based GUI tool which can facilitate the Mule experience for many users who are less technical or who want to have a quick product review of Mule without the hassle of installing the whole Anypoint Studio in their system.
Connector updates are no longer bound to the Runtime updates. They are no longer stored inside Runtime- instead, they are distributed outside. It makes it easier to get the connector updates. So, one can update the whole Runtime to get all the updates of the connectors/components, or one can update only the specific connector/component. This gives us a lot of flexibility and can decrease the problems that we might have when updating the whole Runtime.
In Mule 3, the APIs are not well defined and scattered. In Mule 4 the APIs will be defined in a structured way.
In Mule 3, we have to tune the Runtime, manually defining the Threadpool, etc. But in Mule 4, it will be dynamic and self-tuning so that one can get optimum performance. There will be a centralized global place to tweak the threads instead of tweaking every flow separately.
Mule API and SDK
DevKit has been replaced by Mule SDK. Now one can easily extend Mule. It's totally annotation based. It's similar to Devkit with some advanced functionalities. Most importantly, it will not generate any code automatically, contrary to DevKit. It will make the custom code (component/connectors) easily manageable and smaller in size.
New Ways to Extend Mule
Apart from using SDK to extend Mule, now one can package a flow that performs certain actions to be reused in the form of a connector using Anypoint Studio 7.
A new feature called REST Connect has been introduced in Mule 4. It can take any API specification, e.g. RAML or Swagger, and based on the specification, it can generate a Connector. That means that once you publish an API in the Anypoint Exchange 2, it will automatically convert the API to a connector.
Dependency Relationships in the Exchange
In Anypoint Exchange 2, the APIs can have dependencies.
To migrate from 3.x to Mule 4, it will come with the following tools:
Application Migration Tool: this tool can migrate Mule 3 application syntax to Mule 4 application syntax.
Devkit Migration Tool: this tool can migrate Mule 3 connectors to Mule 4 connectors.
Some Important Changes
Here are some of the important changes that will be available in Mule 4:
Message Structure: Message Structure will be changed in Mule 4. Instead of properties, there will be Attributes, as shown below:
Connector Configuration: The output of connectors can be stored directly in variables. Look at the HTTP request connector:
Expression Language: DW language can be used in MEL, also.
Transformation Inside Connector: Basic DW transformation can be done inside Connector. Please look at this diagram:
These are a few of the many changes that will come along with Mule 4. I will try to cover more in my next sections.
Opinions expressed by DZone contributors are their own.