Anypoint studio 7.0+: Simplified your business integration development

In my previous blog I explained new Mule 4 feature and enhancement of Mule runtime. To support these feature Mulesoft released  new editor with new look and feel. If you are coming from Mule 3 and its Anypoint studio, you will not find much difference but there is lot of makeover of editor and some cool feature in Anypoint studio 7.0. With new Anypoint studio, it accelerates developer productivity with a single graphical environment for integration with SaaS and on-premises systems, API implementation, and testing. It Deploys  your applications on-premises or in the cloud with Mule runtime engine. Anypoint Studio is MuleSoft’s Eclipse-based integration development environment for designing and testing Mule applications.

Now let’s move on new Anypoint studio features and configuration.

1. Installation & Configuration – Download and installation of Anypoint studio is available based on operating system. Download your Anypoint studio based on your operating system. Make sure JDK 1.8 in install and configure in your system before installation of Anypoint studio. This version of Studio is not compatible with Java 9 or Java 10. MuleSoft recommends a minimum of 4GB of free RAM, 2GHz CPU and 10GB free hard drive space available on a developer workstation. To install Anypoint studio you need to extract your  download zip file and set your workspace area in your system. If you are still getting java error during your Anypoint start. Please open AnypointStudio.ini  file and add this line in this file

-vm  C:\software\java\bin

2. Maven – This version of Anypoint studio comes with Maven installation default. You no need to install maven separately like previous version.  Studio comes with Maven 3.3.9 bundled, but you can externally use the versions: 3.3.3 or your own 3.3.9.

3. Mule palette — If you are coming from previous version of Anypoint studio you will find extreme make over  for Mule palette in newer version of Anypoint studio.  It has added couple of section and related action in this Mule palette to speed up the development process. It created two level of palette to improve access times, discoverability and categorization. You can search connector and add modules from Mule palette. You can also search your project/modules in exchange from Mule palette. There is Favorites  section  you can add most used connector and action. Here is couple of sections of Mule palette
Mule Palette
  • Category List
  • Manage you modules
  • Operation inside the category
  • Search Modules from Exchange
  • Add Modules to your current project
  • Favorites
  • Add to favorites

4. Editor/Canvas—Studio editors help you design and edit the definitions of your applications, APIs, properties, and configuration files. In canvas you can see all visual representation of your flows. These flows are collapsible Flows. In new Anypoint editor you can now preview the content of the collapsed flow by simply hovering over the region for a second. New version editor it added new set of graphic icons for better usability. In new Anypoint studio new feature added to navigate from visual view to XML view by simple right clicking on any component and select “Go to XML”

Anypoint Studio Canvas

5. Managing Anypoint platform credential—Through Anypoint studio you can manage and configure Anypoint Platform credentials. To enable this feature you have to browse in Anypoint studio top  navigation

Window->preference->Anypoint Studio->Authentication->Add


Now here you can add multiple user Anypoint platform credential.
Once you add here now when creating a new Mule project (File > New > Mule Project), if you select an API implementation from Design Center, the toolbar displays at the top of the selection dialog.

Project API location from Design Center
Design Center Access

Similarly, if you select Search in Exchange from the Mule Palette, the toolbar displays in a slightly different form.

Add Modules to Project

6. Dataweave everywhere— As Mule 4 supporting Dataweave is default language. Now you can see new  Anypoint editor enable Dataweave for all component. You can now toggle between “literal” and “Expression” modes using the new expression button. When clicking the “Expression” mode, you can use auto-suggestions for Dataweave 2.0.

Dataweave everywhere in Anypoint editor

Additionally, using the expression mode, you can click the New Map button next to Fields to use the visual mapper to build expressions for individual fields.

Dataweave in log message

Conclusion—New Anypoint  studio accelerates  developer productivity with a single graphical environment for integration with SaaS and on-premises systems, API implementation, and testing. Studio enables  you to deploy your applications on-premises or in the cloud with Mule runtime engine.

Mule 4: Ease Your Integration Challenges

Much awaited Mulesoft 4 was officially announced in Mulesoft Connect 2018 in San Jose. When Mulesoft was born, it was really to create software that helps to interact systems or source of information quickly within or outside company. So the speed is an incredibly important thing over the years to develop and interact within systems. Need of speed for application and development hasn’t change drastically over the years but needs and requirement of customer’s application have changed. The integration landscape has also magnified. There are hundreds of new systems and sources of information to connect to, with more and more integration requirements. This integration landscape gets very messy and very quickly.

            Mule 4 provides a simplified language, simplified runtime engine and ultimately reduces management complexity.  It helps customers, developers to deliver application faster. Mule4 is really radically simplified development. It is providing new tool to simplify your development, deployment and management of your integration/API. It is also providing a platform to reuse Mule component without affecting existing application for faster development. Mule 4 is evolution of Mule3. You will not seem lost in Mule 4, if you are coming from Mule3. But Mule 4 implements fewer concepts and steps to simplify whole development/integration process. Mule 4 has now java skill is optional. In this release Mulesoft is improving tool and making error reporting more robust and platform independent.

Now let’s go one by one with all these new Mule4 features.

1. Simplified Event Processing and Messaging — Mule event is immutable, so every change to an instance of a Mule event results in the creation of a new instance. It contains the core information processed by the runtime. It travels through components inside your Mule app following the configured application logic. A Mule event is generated when a trigger (such as an HTTP request or a change to a database or file) reaches the Event source of a flow. This trigger could be an external event triggered by a resource that might be external to the Mule app.

Mule 4 Event flow

2. New Event and Message structure — Mule 4 includes a simplified Mule message model in which each Mule event has a message and variables associated with it. A Mule message is composed of a payload and its attributes (metadata, such as file size). Variables hold arbitrary user information such as operation results, auxiliary values, and so on.

Mule 4 message

Mules 4 do not have Inbound, Outbound and Attachment properties like  Mule 3. In mule 4 all information are saved in variables and attributes. Attributes in Mule 4 replace inbound properties. Attributes can be easily accessed through expressions.

 These are advantages to use Attributes in Mule 4.

  • They are strongly typed, so you can easily see what data is available.
  • They can easily be stored in variables that you can access throughout your flow
Example :
#[attributes.uriParams.jobnumber]

Outbound properties — Mule 4 has no concept for outbound properties like in Mule 3. So you can set status code response or header information in Mule 4 through Dataweave expression without introducing any side effects in the main flow.

Example:

 
<ee:transform xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core
 http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
       <ee:message>
         <ee:set-payload>
           <![CDATA[
                %dw 2.0
                output application/json
                 ---
                 {message: "Bad request"}]]>
           </ee:set-payload>
         </ee:message>
    <ee:variables>
       <ee:set-variable variableName="httpStatus">400</ee:set-variable>
    </ee:variables>
  </ee:transform>

Session Properties –In Mule 4 Session properties are no longer exist. Data store in variables are passes along with  different flow.

3. Seamless data access & streaming – Mule 4 has fewer concepts and steps. Now every steps and task of  java language knowledge is optional. Mule 4 is not only leveraging DataWeave as a transformation language, but expression language as well. For example in Mule 3  XML/CSV data need to be converted into java object to parse or reroute them. Mule 4 gives the ability to parse or reroute through Dataweave expression without converting into java. These steps simplify your implementation without using java.

Mule 4 Data Access

4. Dataweave 2.0 — Mule 4 introduces DataWeave as the default expression language replacing Mule Expression Language (MEL) with a scripting and transformation engine. It is combined with the built-in streaming capabilities; this change simplifies many common tasks. Mule 4 simplifies data iteration. DataWeave knows how to iterate a json array. You don’t even need to specify it is json. No need to use <json:json-to-object-transformer /> to convert data into java object.

Mule 4 vs Mule 3 flow comparison

Here are few points about Dataweave 2.0

  • Simpler syntax to learn
  • Human readable descriptions of all data types
  • Applies complex routing/filter rules.
  • Easy access to payload data without the need for transformation.
  • Performs any kind of data transformation, normalization, grouping, joins, pivoting and filtering.

5. Repeatable Streaming – Mule 4 introduces repeatable streams as its default framework for handling streams. To understand the changes introduced in Mule 4, it is necessary to understand how Mule3 data streams are consumed

Mule 3 data streaming examples

In above three different Mule 3 flows, once stream data is consumed by one node it is empty stream for 2nd node. So in the above first example, in order to log the stream payload , the logger has to consume the entire stream of data from HTTP connector. This means that the full content will be loaded into memory. So if the content is too big and you’re loading into memory, there is a good chance the application might run out of memory.

So Mule 4 repeatable streams enable you to

  • Read a stream more than once
  • Have concurrent access to the stream.
  • Random Access
  • Streams of bytes or streams of objects

As a component consumes the stream, Mule saves its content into a temporary buffer. The runtime then feeds the component from the temporary buffer, ensuring that each component receives the full stream, regardless of how much of the stream was already consumed by any prior component

Here are few points, how repeatable streams works in Mule 4

  • Payload is read into memory as it is consumed
  • If payload stream buffer size is > 512K (default) then it will be persisted to disk.
  • Payload stream buffer size can be increased or decreased by configuration to optimize performance
  • Any stream can be read at any random position, by any random thread concurrently

6. Error Handling — In Mule 4 error handling has been changed significantly. Now In mule 4 you can discover errors at design time with visual interface. You no need to deal with java exception directly and it is easy to discover error while you are building flow. Every flow listed all possible exception which potential arises during execution.

Mule 4 Error Handling

Now errors that occur in Mule fall into two categories

  • Messaging errors
  • System errors

  Messaging errors — Mule throws a messaging error (a Mule error) whenever a problem occurs within a flow. To handle Mule errors, you can set up On Error components inside the scope-like Error Handler component. By default, any unhandled errors are logged and propagated.

System errors — Mule throws a system error when an exception occurs at the system level . If no Mule Event is involved, the errors are handled by a system error handler.

Try catch Scope — Mule 4 introduces a new try scope that you can use within a flow to do error handling of just inner components/connectors. This try scope also supports transactions and in this way it is replacing Old Mule 3 transaction scope.

Mule 4 A new try catch block

7. Class Loader Isolation — Class loader separates application completely from Mule runtime and connector runtime. So, library file changes (jar version) do not affect your application. This  also gives flexibility to your application to run any Spring version without worry about Mulesoft spring version. Connectors are distributed outside the runtime as well, making it possible to get connector enhancements and fixes without having to upgrade the runtime or vice versa

In above pic showing that every component in any application have their own class loader and running independently on own class loader.

8. Runtime Engine — Mule 4 engine is new reactive and non-blocking engine. In Mule 4 non-blocking flow always on, so no processing strategy in flow. One best feature of Mule 4 engine is, It is self-tuning runtime engine. So what does this mean? If Mule 4 engine is processing your applications on 3 different thread pools, So runtime knows  which application should be executed by each thread pool. So operation put in corresponding thread pool based on high intensive CPU processing or light intensive CPU processing or I/O operation. Then 3 pools are dynamic resizing automatically to execute application through self-tuning.


Mule 4 : Self tuning run time engine

So now self-tuning creates custom thread pools based on specific tasks. Mule 4 engine makes it possible to achieve optimal performance without having to do manual tuning steps.

Conclusion

Overall Mule 4 is trying to make application development easy, fast and robust. There are more features included in Mule 4 which I will try to cover in my next blog. I will also try to cover more in depth info in above topic of Mule 4. Please keep tuning for my next blog.