We've all been excitedly waiting for the new version of Mule 4 that Mulesoft will be releasing soon. Here are some important features we want to highlight that will be available in Mule 4:
In Mule 3 when we utilize DW and transform messages we need to explicitly convert the message to a Java object so that the output can be used in Router component, For Each, etc. In Mule 4 you don't need to explictly convert the Message to Java objects, as Mule 4 will do it automatically for you.
The following connectors have been updated: File, FTP, JMS, VM, etc. The connectors have been made operation-based: for example, to create a directory or file, Mule 4 has a connector named File-Create Directory, to write the File: Write directory, etc.
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. And the biggest improvement is that one can catch the exception of some specific block of components (TIBCO has this feature) instead of a centralized exception block. The exceptions can be re-propagated as well.
As shown in the diagram below, we can handle the exceptions of some component(s) in the same main flow:
Exceptions can also be chosen from the dropdown list:
Anypoint Studio 7
The Studio has also been substantially improved. The following new features have been added to the Studio:
The palettes have new icons.
You can now save your favorite palettes.
Deeper Maven integration.
You can right click on a palette and can go directly to its XML configuration.
The flows are collapsible.
New dev tools have been added in Mule 4, one of them being Design Center which is targeted to 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 Runtime updates. They are no longer stored inside Runtime. Instead, they are distributed outside which makes it easier to get the connector updates. So, the user can update the whole Runtime to get all the updates of the connectors/components, or the user can update only the specific connector/component. Thus, it provides a lot of flexibility and can decrease the problems we might otherwise experience when updating the whole Runtime.
In Mule 3 the APIs are not well-defined, and are somewhat scattered. In Mule 4, however, the APIs will be defined in a structured way.
In Mule 3, we have to tune the Runtime by manually defining the Threadpool, etc. However, in Mule 4, it will be dynamic and self-tuning so that the user can get the optimum performance. There will be a centralized, global location to tweak the threads, etc., instead of tweaking each flow separately.
Mule API and SDK
DevKit has been replaced by Mule SDK, which now allows the user to easily extend Mule, as it is completely annotation based. It's similar to DevKit, with some advanced functionalities and one key defining feature: it will not automatically generate any code contrary to DevKit. Instead, 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, the user can package a flow that performs certain actions to be re-used in the form of a connector using Anypoint Studio 7.
Another new feature called REST Connect has been introduced in Mule 4 as well. It can take any API specification such as RAML, Swagger, etc. and generate a Connector based on the specification. So it means that once you publish an API in Anypoint Exchange 2, it will automatically convert the API to a connector.
Dependency Relationships in Exchange
In Anypoint Exchange 2, the API's can have dependency.
To simplify the migration from 3.x to Mule 4 , the following tools are included:
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 transformations can be done inside Connector. Check it out in this diagram:
These are a few of the many changes that will come with Mule 4. I will try to cover more in my next posts.
Anupam Gogoi is an Integration Engineer at Avenue Code. He has been working in software development for about 9 years, implementing solutions in Java technologies as well as in SOA domain. He is a hardcore JAVA and MIDDLEWARE evangelist.