During transformation to JSON often I do not want null properties. It is easy to remove them, by just using skipNullOn attribute. However for empty objects it is not that trivial, especially when you have to deal with many such cases within one transformation. In this article I will show you how you can achieve this quick and easy.
Content Enricher is definitely an useful integration pattern. It allows easily enrich message content with new data gathered from external resource. In vast majority of Mule’s apps I have been using Message Enricher Component. Today I will point main differences
In the 3rd tip I have described nuisance with casting to integer value. This time we will look at really large numbers and their formatting. In addition I will mention scientific notation. All these topic are around number format used
Errors occurs all the time. All you can do is to implement error handling. In this article I will describe how to use introduced layer of abstraction in exceptions area. Prior to Mule 4, developer only could access raw Java exception as Mule is a Java based ESB. This lead to situation where you, as a developer, needed analyse documentation to find exact exception that you would like to handle. Now an Error concept was introduced.
There are time when you need to get one particular element from an array, but not based on the index. This item needs to fulfill some requirements like equality and so on. In order to perform that task selector ? was introduced. This is applicable for both DataWeave 1.0 and 2.0.
I have already presented how to call Java code using messages processors with the newest Java Module for Mule 4.x. For earlier mule’s version Entry Point Resolvers were used to invoke custom Java code. However for scenarios when we would like to use custom code in DataWeave, for transformations, another approach is needed. Approach presented in this article will be more concise comparing to using message processors. It was highly extended comparing to possibilities of Mule 3.x version. Mule 3 allowed to invoke static methods. In contract Mule 4 not only permits to call static methods but also instantiate classes and access its instance attributes.
It is a good practice to monitor your service and check whether it is available and/or is performing as expected. In order to do this we need to specify what service’s health term means. In this article I will present two
Tip number 2 is about converting decimal number into integer one. This may seem tricky at first. You may say that we do not need to do anything special and DataWeave engine will handle it underneath. However there is a nuance that you should be aware of. In transformation to XML this may not actually works. This tip is primary dedicated to DataWeave 1.0 as in DataWeave 2.0 this does not occur.
In one of my previous posts I described Java Component and entry point resolvers as a way to invoke Java Code in Mule 3.x. In this article I will focus on completely new approach in Mule 4. Mule presents brand new Java Module capable of creating new instances, invoking methods on those instances and invoking static methods. Although you can invoke Java using DataWeave 2.0 and Groovy scripting you are losing additional metadata (DataSense). So lets walk through some sample application.
Tip number 1 will be about data existence check. There are often situation that nearly the same conditions need to be checked in every line. I have seen many transformations that were really long and complex. Reading them were not only difficult but a lot of repeatable conditional checks were made. Here I will show you an example that will evolve to point where we reuse everything that was possible. As a result we should achieve more concise and readable transformation. As new DataWeave is about to be released, examples will be both in 1.0 and 2.0.