SlideShare a Scribd company logo
Using the DataWeave Transformer
 In Anypoint Studio, you can place a Transform
Message element in a flow to create transformations
using the DataWeave language.
 The editor helps you do this by offering intelligent
autocomplete suggestions, an output preview that is
updated in real time as you make changes.
 This generates a .dwl transformation file (or several of
them) that stores your code and is packaged with your
Mule application.
 When adding a Transform Message element to a Mule
Flow, it takes the elements from the incoming Mule
Message as its inputs. It then performs the necessary
actions to produce a Mule message as output for the
next element in the flow
 The DataWeave Text Editor GUI
 The Transform Message element allows you to freely
write DataWeave code.
 If you click on an instance of the Transform Message
element in your flow, its properties editor will be
displayed. This editor is divided into three sections:
 Input
 Transform
 Output
Input Section
In the main tab, a tree view shows the known metadata
contents of the incoming Mule Message, allowing you to
explore it and know what data is available for using as an
input, and how to reference each part of it.
If the Mule flow doesn’t expose Metadata about the
elements you need from the incoming message, you can
manually specify it. To do so, select the element of the
input you desire to define, note that the pencil icon at
the top right is no longer grayed out. Click this icon to
open a new tab in your input section where you can
define a sample with the structure of this data.
When the input is of JSON or XML types, the sample input contains plain XML or JSON
code. When the input is of type POJO or DataWeave, the sample input is written
in DataWeave for more simplicity. In these cases the sample DataWeave code is merely a
way to display the sample data, not a transformation in itself.
Setting Reader Parameters
 Some input formats, like CSV, allow you to define a
reader with specific properties that make
DataWeave parse inputs differently. Select the
input element you wish to configure on the tree
view of the input section, then click the gear icon.
Transform Section
 you write the actual DataWeave code that carries out
the transform. Notice that changing the type of your
output directive changes the output section of the
editor. Although DataWeave as a language supports
adding input directives and naming these by any name
you like, in Studio the elements of the input message
are implicitly considered input directives and so they
don’t need to be defined in the header.
If Studio has any metadata about the components that
are upstream or downstream from your Transform
Message element at the time when you add the
component to your flow, a scaffolding for
your DataWeave code is written out automatically, with
as much depth as Studio can intelligently deduce. In
some cases, this code may be enough to carry out the
transformation you need, and no additional coding is
needed. Sometimes, all you need to do is fill in the blank
spaces in the scaffolding with references to the input
fields, other times you may want to carry out more
complex operations that involve aggregation, filtering,
calculations, defining custom functions, etc and there
you must write this out in DataWeave code.
Re-scaffolding Once you’ve added the Transform Message element
to your flow, any further changes you make to the
surrounding message processors and their metadata
won’t affect your `.dw`l file. You may still click the
Scaffolding button on the top left of the DataWeave
properties editor any time you want and have a new
scaffolding built, note that this will erase anything
you’ve written in the DataWeave body. Doing this
won’t affect any directives you defined in your header
(except for the output directive). Use this button if
you’ve made any changes to elements that come after
the Transform Message element on the flow that
expose metadata and don’t mind loosing what you’ve
already written into the transform’s body.
Referencing Existing Transforms
Instead of defining a new .dwl file, you can reference an
existing one by clicking theData Source button,
selecting On File as the source and referencing the
correct file.
Handling Multiple Outputs
A single Transform Message element can give shape to
several different components of the output Mule
message. Each of these output components must be
defined in a separate .dwl file, written out in a separate
tab of the Transform section. For example in one tab you
may be defining the payload contents, in another those
of an outbound property, and these will both be parts of
the same output Mule message
To add a new output, click the Plus sign at the
bottom right of the section:new+output.png[image]
A new tab will then appear, there you can specify
where in the output Mule message to place the
output of this DataWeave transform. In case you’re
creating a new variable or property, you must also
set a name for it.
In the XML editor you can do the same by adding
multiple child elements inside thedw:transform-
message component.
<dw:transform-message>
<dw:set-payload resource="classpath:path/transform.dwl"/> <dw:set-
variable variableName="myVariable"
resource="classpath:path/transform.dwl"/> <dw:set-session-variable
variableName="mySessionVariable"
resource="classpath:path/transform.dwl"/> </dw:transform-message>
Output Section
 This section has two tabs, one of them shows you a neat
expandable tree view of the output data structure, the
other shows you a preview of what the actual output looks
like, built from any sample data you provide in the input
section. As you make changes in the transport section,
notice how the data structure changes. The output of the
transformer is made into the selected component of the
output mule message. If your transformer has multiple
outputs, the Preview tab will display the one
corresponding to the currently selected transform.
Using DataWeave Language
Elsewhere
 All components in Mule that support Mule Expression
Language also support expressions written in DataWeave
Language. To invoke an expression written in DataWeave
language, simply invoke the dw() function, the expression
will return whatever the transform outputs.
 DataWeave expressions defined within this function work
just as those defined within a Transform Message element,
the only difference is that the output is returned into the
expression’s result, wherever it may be.
 For example, you can define a custom object and
populate it with elements from the payload:
 That same expression could be added inside a Logger,
 within a MEL expression, to print out its result:
dw(myobject:{id:payload.accountid, user:payload.user})
#[`dw(myobject:{id:payload.accountid, user:payload.user})`]

More Related Content

What's hot

Responsive Design and Bootstrap
Responsive Design  and BootstrapResponsive Design  and Bootstrap
Responsive Design and Bootstrap
MahmoudOHassouna
 
OBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - TutorialOBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - Tutorial
onlinetrainingplacements
 
Oracle Form material
Oracle Form materialOracle Form material
Oracle Form material
Rajesh Ch
 
Generic steps in informatica
Generic steps in informaticaGeneric steps in informatica
Generic steps in informatica
Bhuvana Priya
 
Oracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and AnswersOracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and Answers
douglascarnicelli
 
Rational Publishing Engine with Rational DOORS
Rational Publishing Engine with Rational DOORSRational Publishing Engine with Rational DOORS
Rational Publishing Engine with Rational DOORS
GEBS Reporting
 
XLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & TricksXLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & Tricks
guest92a5de
 
Oracle report from ppt
Oracle report from pptOracle report from ppt
Oracle report from ppt
kingshuk_goswami
 
Reports 6i
Reports 6iReports 6i
Reports 6i
Senthamarai B
 
Oracle9i reports developer
Oracle9i reports developerOracle9i reports developer
Oracle9i reports developer
FITSFSd
 
VB6 Using ADO Data Control
VB6 Using ADO Data ControlVB6 Using ADO Data Control
VB6 Using ADO Data Control
Notre Dame of Midsayap College
 
Oracle D2K reports
Oracle D2K reports Oracle D2K reports
Oracle D2K reports
Rajesh Ch
 
d2k
d2kd2k
synopsis
synopsissynopsis
synopsis
jayant parmar
 

What's hot (14)

Responsive Design and Bootstrap
Responsive Design  and BootstrapResponsive Design  and Bootstrap
Responsive Design and Bootstrap
 
OBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - TutorialOBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - Tutorial
 
Oracle Form material
Oracle Form materialOracle Form material
Oracle Form material
 
Generic steps in informatica
Generic steps in informaticaGeneric steps in informatica
Generic steps in informatica
 
Oracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and AnswersOracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and Answers
 
Rational Publishing Engine with Rational DOORS
Rational Publishing Engine with Rational DOORSRational Publishing Engine with Rational DOORS
Rational Publishing Engine with Rational DOORS
 
XLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & TricksXLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & Tricks
 
Oracle report from ppt
Oracle report from pptOracle report from ppt
Oracle report from ppt
 
Reports 6i
Reports 6iReports 6i
Reports 6i
 
Oracle9i reports developer
Oracle9i reports developerOracle9i reports developer
Oracle9i reports developer
 
VB6 Using ADO Data Control
VB6 Using ADO Data ControlVB6 Using ADO Data Control
VB6 Using ADO Data Control
 
Oracle D2K reports
Oracle D2K reports Oracle D2K reports
Oracle D2K reports
 
d2k
d2kd2k
d2k
 
synopsis
synopsissynopsis
synopsis
 

Viewers also liked

Creating dynamic json
Creating dynamic json Creating dynamic json
Creating dynamic json
Khasim Saheb
 
Automatic documantation with mule
Automatic documantation with mule Automatic documantation with mule
Automatic documantation with mule
Khasim Saheb
 
How to use expression filter
How to use expression filterHow to use expression filter
How to use expression filter
Khasim Saheb
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
Khasim Saheb
 
A simple webservice with vm
A simple webservice with vm A simple webservice with vm
A simple webservice with vm
Khasim Saheb
 
Webservices using Salesforce
Webservices using SalesforceWebservices using Salesforce
Webservices using Salesforce
Khasim Saheb
 
Pesquisanaescolasoniaantonia
PesquisanaescolasoniaantoniaPesquisanaescolasoniaantonia
PesquisanaescolasoniaantoniaSonia Fukuda
 
Converting with custom transforme
Converting with custom transformeConverting with custom transforme
Converting with custom transforme
Khasim Saheb
 
Mule security jaas
Mule security jaasMule security jaas
Mule security jaas
Khasim Saheb
 
web services
web servicesweb services
web services
Khasim Saheb
 
Mule Esb
Mule EsbMule Esb
Mule Esb
Khasim Saheb
 
Mule esb api layer
Mule esb api layerMule esb api layer
Mule esb api layer
Khasim Saheb
 
Mule architecture
Mule architectureMule architecture
Mule architecture
Khasim Saheb
 
Stored procedure in Mule
Stored procedure in MuleStored procedure in Mule
Stored procedure in Mule
Khasim Saheb
 
Mule integration with linkedin
Mule integration with linkedinMule integration with linkedin
Mule integration with linkedin
Khasim Saheb
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in Mule
Khasim Saheb
 
Mule soa
Mule soaMule soa
Mule soa
Khasim Saheb
 
Shripal Doshi CV
Shripal Doshi CVShripal Doshi CV
Shripal Doshi CV
shripaldoshi
 

Viewers also liked (18)

Creating dynamic json
Creating dynamic json Creating dynamic json
Creating dynamic json
 
Automatic documantation with mule
Automatic documantation with mule Automatic documantation with mule
Automatic documantation with mule
 
How to use expression filter
How to use expression filterHow to use expression filter
How to use expression filter
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
 
A simple webservice with vm
A simple webservice with vm A simple webservice with vm
A simple webservice with vm
 
Webservices using Salesforce
Webservices using SalesforceWebservices using Salesforce
Webservices using Salesforce
 
Pesquisanaescolasoniaantonia
PesquisanaescolasoniaantoniaPesquisanaescolasoniaantonia
Pesquisanaescolasoniaantonia
 
Converting with custom transforme
Converting with custom transformeConverting with custom transforme
Converting with custom transforme
 
Mule security jaas
Mule security jaasMule security jaas
Mule security jaas
 
web services
web servicesweb services
web services
 
Mule Esb
Mule EsbMule Esb
Mule Esb
 
Mule esb api layer
Mule esb api layerMule esb api layer
Mule esb api layer
 
Mule architecture
Mule architectureMule architecture
Mule architecture
 
Stored procedure in Mule
Stored procedure in MuleStored procedure in Mule
Stored procedure in Mule
 
Mule integration with linkedin
Mule integration with linkedinMule integration with linkedin
Mule integration with linkedin
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in Mule
 
Mule soa
Mule soaMule soa
Mule soa
 
Shripal Doshi CV
Shripal Doshi CVShripal Doshi CV
Shripal Doshi CV
 

Similar to Data weave

Mule data weave
Mule data weaveMule data weave
Mule data weave
D.Rajesh Kumar
 
Data weave
Data weaveData weave
Data weave
Adithya-kuchan
 
Data weave
Data weave Data weave
Data weave
princeirfancivil
 
Data weave
Data weave Data weave
Data weave
Phaniu
 
Data weave
Data weave Data weave
Data weave
mdfkhan625
 
Data weave
Data weave Data weave
Data weave
irfan1008
 
Data weave in Mule
Data weave in MuleData weave in Mule
Data weave in Mule
RaviShankar Mishra
 
Dataweave nagarjuna
Dataweave nagarjunaDataweave nagarjuna
Dataweave nagarjuna
Nagarjuna reddy
 
Dataweave in studio
Dataweave in studioDataweave in studio
Dataweave in studio
Achyuta Lakshmi Puvvala
 
Mca 504 dotnet_unit5
Mca 504 dotnet_unit5Mca 504 dotnet_unit5
Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200
harika thamishetti
 
Mule dataweave
Mule dataweaveMule dataweave
Mule dataweave
Son Nguyen
 
Data weave documentation
Data weave documentationData weave documentation
Data weave documentation
Khadhar Koneti
 
Data weave in mule
Data weave in muleData weave in mule
Data weave in mule
Ramakrishna kapa
 
Mule with data weave
Mule with data weaveMule with data weave
Mule with data weave
Son Nguyen
 
Transf from csv to xml
Transf from csv to xmlTransf from csv to xml
Transf from csv to xml
Davide Rapacciuolo
 
2 designer
2 designer2 designer
2 designer
Ravindra Gangwar
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
StrawhatLuffy11
 
Data weave reference documentation
Data weave reference documentationData weave reference documentation
Data weave reference documentation
D.Rajesh Kumar
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssis
deepakk073
 

Similar to Data weave (20)

Mule data weave
Mule data weaveMule data weave
Mule data weave
 
Data weave
Data weaveData weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Data weave in Mule
Data weave in MuleData weave in Mule
Data weave in Mule
 
Dataweave nagarjuna
Dataweave nagarjunaDataweave nagarjuna
Dataweave nagarjuna
 
Dataweave in studio
Dataweave in studioDataweave in studio
Dataweave in studio
 
Mca 504 dotnet_unit5
Mca 504 dotnet_unit5Mca 504 dotnet_unit5
Mca 504 dotnet_unit5
 
Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200
 
Mule dataweave
Mule dataweaveMule dataweave
Mule dataweave
 
Data weave documentation
Data weave documentationData weave documentation
Data weave documentation
 
Data weave in mule
Data weave in muleData weave in mule
Data weave in mule
 
Mule with data weave
Mule with data weaveMule with data weave
Mule with data weave
 
Transf from csv to xml
Transf from csv to xmlTransf from csv to xml
Transf from csv to xml
 
2 designer
2 designer2 designer
2 designer
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
 
Data weave reference documentation
Data weave reference documentationData weave reference documentation
Data weave reference documentation
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssis
 

More from Khasim Saheb

Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchange
Khasim Saheb
 
Mule soap
Mule soapMule soap
Mule soap
Khasim Saheb
 
Mule security saml
Mule security samlMule security saml
Mule security saml
Khasim Saheb
 
Mule for each scope headerc ollection
Mule for each scope headerc ollectionMule for each scope headerc ollection
Mule for each scope headerc ollection
Khasim Saheb
 
Mule esb
Mule esbMule esb
Mule esb
Khasim Saheb
 
Mule esb stripe
Mule esb stripeMule esb stripe
Mule esb stripe
Khasim Saheb
 
Mmc
MmcMmc
Mmc rest api user groups
Mmc rest api user groupsMmc rest api user groups
Mmc rest api user groups
Khasim Saheb
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
Khasim Saheb
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
Khasim Saheb
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
Khasim Saheb
 
Cache for community edition
Cache for community edition Cache for community edition
Cache for community edition
Khasim Saheb
 
mule salesforce
mule salesforcemule salesforce
mule salesforce
Khasim Saheb
 
mulesoft filters
mulesoft filtersmulesoft filters
mulesoft filters
Khasim Saheb
 
mulesoft at a glance
mulesoft at a glancemulesoft at a glance
mulesoft at a glance
Khasim Saheb
 
Core Java
Core JavaCore Java
Core Java
Khasim Saheb
 

More from Khasim Saheb (16)

Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchange
 
Mule soap
Mule soapMule soap
Mule soap
 
Mule security saml
Mule security samlMule security saml
Mule security saml
 
Mule for each scope headerc ollection
Mule for each scope headerc ollectionMule for each scope headerc ollection
Mule for each scope headerc ollection
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule esb stripe
Mule esb stripeMule esb stripe
Mule esb stripe
 
Mmc
MmcMmc
Mmc
 
Mmc rest api user groups
Mmc rest api user groupsMmc rest api user groups
Mmc rest api user groups
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Cache for community edition
Cache for community edition Cache for community edition
Cache for community edition
 
mule salesforce
mule salesforcemule salesforce
mule salesforce
 
mulesoft filters
mulesoft filtersmulesoft filters
mulesoft filters
 
mulesoft at a glance
mulesoft at a glancemulesoft at a glance
mulesoft at a glance
 
Core Java
Core JavaCore Java
Core Java
 

Recently uploaded

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 

Recently uploaded (20)

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 

Data weave

  • 1.
  • 2. Using the DataWeave Transformer  In Anypoint Studio, you can place a Transform Message element in a flow to create transformations using the DataWeave language.  The editor helps you do this by offering intelligent autocomplete suggestions, an output preview that is updated in real time as you make changes.  This generates a .dwl transformation file (or several of them) that stores your code and is packaged with your Mule application.
  • 3.  When adding a Transform Message element to a Mule Flow, it takes the elements from the incoming Mule Message as its inputs. It then performs the necessary actions to produce a Mule message as output for the next element in the flow
  • 4.  The DataWeave Text Editor GUI  The Transform Message element allows you to freely write DataWeave code.  If you click on an instance of the Transform Message element in your flow, its properties editor will be displayed. This editor is divided into three sections:  Input  Transform  Output
  • 5. Input Section In the main tab, a tree view shows the known metadata contents of the incoming Mule Message, allowing you to explore it and know what data is available for using as an input, and how to reference each part of it. If the Mule flow doesn’t expose Metadata about the elements you need from the incoming message, you can manually specify it. To do so, select the element of the input you desire to define, note that the pencil icon at the top right is no longer grayed out. Click this icon to open a new tab in your input section where you can define a sample with the structure of this data.
  • 6. When the input is of JSON or XML types, the sample input contains plain XML or JSON code. When the input is of type POJO or DataWeave, the sample input is written in DataWeave for more simplicity. In these cases the sample DataWeave code is merely a way to display the sample data, not a transformation in itself.
  • 7. Setting Reader Parameters  Some input formats, like CSV, allow you to define a reader with specific properties that make DataWeave parse inputs differently. Select the input element you wish to configure on the tree view of the input section, then click the gear icon.
  • 8. Transform Section  you write the actual DataWeave code that carries out the transform. Notice that changing the type of your output directive changes the output section of the editor. Although DataWeave as a language supports adding input directives and naming these by any name you like, in Studio the elements of the input message are implicitly considered input directives and so they don’t need to be defined in the header.
  • 9. If Studio has any metadata about the components that are upstream or downstream from your Transform Message element at the time when you add the component to your flow, a scaffolding for your DataWeave code is written out automatically, with as much depth as Studio can intelligently deduce. In some cases, this code may be enough to carry out the transformation you need, and no additional coding is needed. Sometimes, all you need to do is fill in the blank spaces in the scaffolding with references to the input fields, other times you may want to carry out more complex operations that involve aggregation, filtering, calculations, defining custom functions, etc and there you must write this out in DataWeave code.
  • 10. Re-scaffolding Once you’ve added the Transform Message element to your flow, any further changes you make to the surrounding message processors and their metadata won’t affect your `.dw`l file. You may still click the Scaffolding button on the top left of the DataWeave properties editor any time you want and have a new scaffolding built, note that this will erase anything you’ve written in the DataWeave body. Doing this won’t affect any directives you defined in your header (except for the output directive). Use this button if you’ve made any changes to elements that come after the Transform Message element on the flow that expose metadata and don’t mind loosing what you’ve already written into the transform’s body.
  • 11. Referencing Existing Transforms Instead of defining a new .dwl file, you can reference an existing one by clicking theData Source button, selecting On File as the source and referencing the correct file.
  • 12. Handling Multiple Outputs A single Transform Message element can give shape to several different components of the output Mule message. Each of these output components must be defined in a separate .dwl file, written out in a separate tab of the Transform section. For example in one tab you may be defining the payload contents, in another those of an outbound property, and these will both be parts of the same output Mule message
  • 13. To add a new output, click the Plus sign at the bottom right of the section:new+output.png[image] A new tab will then appear, there you can specify where in the output Mule message to place the output of this DataWeave transform. In case you’re creating a new variable or property, you must also set a name for it.
  • 14. In the XML editor you can do the same by adding multiple child elements inside thedw:transform- message component. <dw:transform-message> <dw:set-payload resource="classpath:path/transform.dwl"/> <dw:set- variable variableName="myVariable" resource="classpath:path/transform.dwl"/> <dw:set-session-variable variableName="mySessionVariable" resource="classpath:path/transform.dwl"/> </dw:transform-message>
  • 15. Output Section  This section has two tabs, one of them shows you a neat expandable tree view of the output data structure, the other shows you a preview of what the actual output looks like, built from any sample data you provide in the input section. As you make changes in the transport section, notice how the data structure changes. The output of the transformer is made into the selected component of the output mule message. If your transformer has multiple outputs, the Preview tab will display the one corresponding to the currently selected transform.
  • 16. Using DataWeave Language Elsewhere  All components in Mule that support Mule Expression Language also support expressions written in DataWeave Language. To invoke an expression written in DataWeave language, simply invoke the dw() function, the expression will return whatever the transform outputs.  DataWeave expressions defined within this function work just as those defined within a Transform Message element, the only difference is that the output is returned into the expression’s result, wherever it may be.
  • 17.  For example, you can define a custom object and populate it with elements from the payload:  That same expression could be added inside a Logger,  within a MEL expression, to print out its result: dw(myobject:{id:payload.accountid, user:payload.user}) #[`dw(myobject:{id:payload.accountid, user:payload.user})`]