Mule 3.8-9: Creating Reusable Dataweave 1.0 Functions and Variables

In this article, I will explain how to create a reusable Dataweave 1.0 Function and Variable. Using readUrl() function, this will allow us to import an external Dataweave File to another Transform Message.

First, we need to create a .DWL file under src/main/resources. In this file, we are going to define our reusable function and variable on the DW Header. To expose the function and variable defined in DW Header, we need to call that on the DW Body to make it accessible when we use the readUrl() function on another Transform Message. https://goo.gl/N7nUcL