Understanding modules in DataWeave
Some programming languages make use of libraries to import functions or methods from other pieces of code. This is helpful to reuse complex functionality that was written by someone else instead of trying to reinvent the wheel and wasting precious development time while trying to develop the code yourself. In DataWeave, these libraries of code are called modules. You can either use other existing DataWeave modules or create your own custom modules, which we will see later in Using the Transform Message component in Anypoint Studio section.
Let’s see the syntax to import these modules in DataWeave.
Importing modules and functions
There are several ways of importing modules or functions to your DataWeave scripts, depending on your preference. But all of them make use of the import
keyword and must be located within the header of your script. Let’s see some examples:
- Import the whole module: You can import the whole module...