DataWeave is the MuleSoft expression language purpose-built for data integration (accessing and transforming data) that travels through a Mule app. DataWeave is tightly integrated with the Mule runtime engine, which runs the scripts and expressions in your Mule app. You can find all the details here.
As MuleSoft Professionals we develop using Anypoint Studio (learn everything about the new 7.7 release here!), where we also work our DataWeave transformations logic. Generally speaking, you need Studio installed for then to go through some local configuration, create a Mule Project, define the metadata in your DataWeave and you are ready to go.
What do you do when Studio is not available (New workspace, new device, maven misconfiguration, wrong JDK, etc.)? How do you learn and practice DataWeave? You don’t want to have to open Studio, create a new Mule Project, add a DataWeave component, define the input metadata, define the output metadata so that then you can finally practice the DataWeave language
Now we now understand the pain point our goal for today is to make your life easier!
Online DataWeave 2.0
We have a solution that you can start using right now: the Online Dataweave Playground! Check out what this tool looks like:
There are three ways to work with the Online DataWeave tool:
- [RECOMMENDED] Access online to the pre-alpha directly from the browser! Interested in contributing? Submit your pull requests.
- Running as a Docker container.The docker image can also be run and hosted by your own internal server or local device.
- Running in a local machine with Maven/java. As variety is the spice of life you can also run the application locally in your device or preferred server by using the JDK/Maven
DataWeave playground and tutorial (pre-alpha)
Checkout the DataWeave tutorial for a step-by-step on how to use the code snippets and execute them right from your browser! It will cover the typical zero-to-hero DataWeave tutorials supported in both code and documentation. You can also submit your pull requests on to provide feedback on the early release.
Running DataWeave in Docker
- Install Docker.
- Check the latest Docker version of the DataWeave Playground in DockerHub
- Open your terminal and download the version you would like (this will take a while):
- docker pull machaval/dw-playground:2.3.1-SNAPSHOT
- Next you need to spin up that container, run the following command
- docker run –name DataWeaveRunner -p 50007:8080 machaval/dw-playground:2.3.1-SNAPSHOT
- After seeing “The dw-playground was started at 8080,” go to localhost:50007.
- And you’re done!
You can stop the execution and next time use the DockerDashboard or run docker start DataWeaveRunner.
Running DataWeave in a local machine with Maven/java
- Install JDK/Maven
- Download and extract the source code from the dataweave-playground repository
- Open the folder from your terminal/prompt and run (it will take a while)
- mvn clean install
- Execute the class:
- mvn exec:java -Dexec.mainClass=”com.github.estebanwasinger.DWPlayground”
- That it is it! You will see the application running as below:
That is all for today, you can keep working and practicing with the different scenarios described in the DataWeave Quickstart Tutorial. As a next step, you are now able to master all the DataWeave operators, find the full list here: DataWeave functions.
Do you want to go to the next level? Let us help, get some training to hasten your learning: Development in DataWeave course
Disclaimer (http://dwlang.fun/): It is not an officially supported MuleSoft Product. It is not supported by MuleSoft Support, you won’t be able to open MuleSoft Support cases for this Suite and there are no SLAs for responses nor bug/features progress. Interested in contributing? You can submit your pull requests here.