SlideShare a Scribd company logo
Mule with DataWeave
• Data transformation is an inevitable component of connectivity, as most
systems don’t speak the same language. Even when the format is similar, as
when two RESTful Web APIs exchange JSON payloads, their message
structure typically differs, making translation a necessity.
• Calling Global MEL Functions from DataWeave
Code :
o If you define a global Mule Expression Language (MEL) function
in your Mule project, you can then invoke it anywhere in your
DataWeave code, without need for any special syntax.
o To create one such global function, you must edit your Mule
project’s XML file and enclose any functions that you wish to
define in the following set of tags
<configuration doc:name="Configuration">
<expression-language>
<global-functions>
</global-functions>
</expression-language>
</configuration>
DataWeave – Body
• Calling Global MEL Functions from DataWeave
Code :
oThis global MEL function must be placed in the
global elements section, before any of the flows are
defined.
oIn the empty space in the tags shown in previous slide,
you can use any MEL expression to define custom
functions.
oExample :
<configuration doc:name="Configuration">
<expression-language>
<global-functions>
def newUser() {
return ["name" : "mariano"]
}
def upperName(user) {
return user.name.toUpperCase()
}
</global-functions>
</expression-language>
</configuration>
DataWeave – Body
• Calling Global MEL Functions from DataWeave
Code :
o With the MEL global function in place, in the DataWeave
code of your Transform Message element you can just refer
to these functions.
o Note that the inputs and outputs of these functions can even
be objects and arrays.
o Example :
%dw 1.0
%output application/json
---
{
"foo" : newUser(),
"bar": upperName(newUser())
}
o Even with these external functions in place, you should be
able to preview the output of this transform, updated in
real time as you edit it.
DataWeave – Body
• Read :
o The read function returns the result of parsing the content parameter
with the specified mimeType reader.
o It accepts three parameters :
• The first argument points the content that must be read.
• The second is the format in which to write it.
• A third optional argument lists reader configuration properties.
o Example :
o In the example above, what was in the CDATA element isn’t parsed
by the DataWeave reader by default, that’s why the read operator
must be used to interpret it.
DataWeave – Body
Transform Input Output
%dw 1.0
%output application/xml
---
output: read(payload.root.xmlblock,
"application/xml").foo
<?xml version='1.0' encoding='UTF-
8'?>
<root>
<xmlblock><![CDATA[<foo>bar</foo>]
]></xmlblock>
</root>
<?xml version='1.0'
encoding='UTF-8'?>
<output>bar</output>
• Write :
o The write function returns a string with the serialized
representation of the value in the specified mimeType.
o It accepts three parameters :
• The first argument points to the element that must be written.
• the second is the format in which to write it.
• A third optional argument lists writer configuration properties.
o Example :
DataWeave – Body
Transform Input Output
%dw 1.0
%output application/xml
---
{
output: write(payload,
"application/csv",
{"separator" : "|"})
}
"Name": "Mr White",
"Email": "white@mulesoft.com",
"Id": "1234",
"Title": "Chief Java Prophet"
},
{
"Name": "Mr Orange",
"Email": "orange@mulesoft.com",
"Id": "4567",
"Title": "Integration Ninja"
}
]
<?xml version='1.0' encoding='US-
ASCII'?>
<output>Name|Email|Id|Title
Mr
White|white@mulesoft.com|1234|Chief
Java Prophet
Mr
Orange|orange@mulesoft.com|4567|Inte
gration Ninja
</output>
• Log :
o Returns the specified value and also logs the value in the
DataWeave representation with the specified prefix.
o Example :
o Note that besides producing the expected output, it also logs it.
DataWeave – Body
Transform Output Output To Logger
%dw 1.0
%output application/json
---
{
result: log("Logging the
array",[1,2,3,4])
}
{
"result": [1,2,3,4]
}
Logging the array [1,2,3,4]
• Calling External Flows
oyou can trigger the calling of a different flow in your
Mule application from a DataWeave transform,
through the following expression:
lookup(“flowName”,$)
Which takes two parameters:
• The name of the flow that must be called
• The payload to send to this flow, as a map
DataWeave – Body –External Flows
• Calling External Flows
oExample :
onote that only the payload returned by the invoked
flow will be assigned (i.e. all other message’s properties
such as flowVars and sessionVars will not be
overridden when using the lookup function).
oThe lookup function does not support calling subflows.
DataWeave – Body –External Flows
Transform Mule Flow Output
%dw 1.0
%output application/json
---
{
a:
lookup("mySecondFlow",{b:"Hello"})
}
<flow name="mySecondFlow">
<set-payload doc:name="Set
Payload" value="#[payload.b + '
world!' ]"/>
</flow>
{
"a": "Hello
world!"
}

More Related Content

What's hot

Dataweave
DataweaveDataweave
Dataweave
krishashi
 
Mule data weave_3
Mule data weave_3Mule data weave_3
Mule data weave_3
kunal vishe
 
Passing java arrays in oracle stored procedure from mule esb flow
Passing java arrays in oracle stored procedure from mule esb flowPassing java arrays in oracle stored procedure from mule esb flow
Passing java arrays in oracle stored procedure from mule esb flow
Priyobroto Ghosh (Mule ESB Certified)
 
MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64
akashdprajapati
 
Utilized JAXB to generate POJOs automatically
Utilized JAXB to generate POJOs automaticallyUtilized JAXB to generate POJOs automatically
Utilized JAXB to generate POJOs automaticallyGuo Albert
 
Component bindings in mule
Component bindings in muleComponent bindings in mule
Component bindings in mule
Sindhu VL
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
StrawhatLuffy11
 
Integrate with database by groovy
Integrate with database by groovyIntegrate with database by groovy
Integrate with database by groovy
Son Nguyen
 
Mule batch
Mule batchMule batch
Mule batch
Gandham38
 
Mule esb
Mule esbMule esb
Mule esb
charan teja R
 
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its ModuleMuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its Module
Jitendra Bafna
 
Refreshing mule cache using oracle database change notification
Refreshing mule cache using oracle database change notificationRefreshing mule cache using oracle database change notification
Refreshing mule cache using oracle database change notification
Priyobroto Ghosh (Mule ESB Certified)
 
Mule data weave_6
Mule data weave_6Mule data weave_6
Mule data weave_6
kunal vishe
 
Mule batch processing
Mule batch processingMule batch processing
Mule batch processing
Ravinder Singh
 
Data weave component
Data weave componentData weave component
Data weave component
Sindhu VL
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo
javeed_mhd
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
AnilKumar Etagowni
 
Python component in mule
Python component in mulePython component in mule
Python component in mule
Ramakrishna kapa
 
MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher
akashdprajapati
 

What's hot (19)

Dataweave
DataweaveDataweave
Dataweave
 
Mule data weave_3
Mule data weave_3Mule data weave_3
Mule data weave_3
 
Passing java arrays in oracle stored procedure from mule esb flow
Passing java arrays in oracle stored procedure from mule esb flowPassing java arrays in oracle stored procedure from mule esb flow
Passing java arrays in oracle stored procedure from mule esb flow
 
MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64
 
Utilized JAXB to generate POJOs automatically
Utilized JAXB to generate POJOs automaticallyUtilized JAXB to generate POJOs automatically
Utilized JAXB to generate POJOs automatically
 
Component bindings in mule
Component bindings in muleComponent bindings in mule
Component bindings in mule
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
 
Integrate with database by groovy
Integrate with database by groovyIntegrate with database by groovy
Integrate with database by groovy
 
Mule batch
Mule batchMule batch
Mule batch
 
Mule esb
Mule esbMule esb
Mule esb
 
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its ModuleMuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its Module
 
Refreshing mule cache using oracle database change notification
Refreshing mule cache using oracle database change notificationRefreshing mule cache using oracle database change notification
Refreshing mule cache using oracle database change notification
 
Mule data weave_6
Mule data weave_6Mule data weave_6
Mule data weave_6
 
Mule batch processing
Mule batch processingMule batch processing
Mule batch processing
 
Data weave component
Data weave componentData weave component
Data weave component
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Python component in mule
Python component in mulePython component in mule
Python component in mule
 
MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher
 

Viewers also liked

Composite source in bound and out-bound
Composite source in bound and out-boundComposite source in bound and out-bound
Composite source in bound and out-bound
Son Nguyen
 
Jms queue
Jms queueJms queue
Jms queue
Son Nguyen
 
Using message enricher
Using message enricherUsing message enricher
Using message enricher
Son Nguyen
 
Message processor in mule
Message processor in muleMessage processor in mule
Message processor in mule
Son Nguyen
 
Google drive connection
Google drive connectionGoogle drive connection
Google drive connection
Son Nguyen
 
Using map and list starter
Using map and list starterUsing map and list starter
Using map and list starter
Son Nguyen
 
Batch job processing
Batch job processingBatch job processing
Batch job processing
Son Nguyen
 
Expression language in mule
Expression language in muleExpression language in mule
Expression language in mule
Son Nguyen
 
Mule flow overview
Mule flow overviewMule flow overview
Mule flow overview
Son Nguyen
 
Android intergrate with mule
Android intergrate with muleAndroid intergrate with mule
Android intergrate with mule
Son Nguyen
 
Wsdl connector introduction
Wsdl connector introductionWsdl connector introduction
Wsdl connector introduction
Son Nguyen
 
Mule flow and filter
Mule flow and filterMule flow and filter
Mule flow and filter
Son Nguyen
 
Handle exceptions in mule
Handle exceptions in muleHandle exceptions in mule
Handle exceptions in mule
Son Nguyen
 
Spring security integrate with mule
Spring security integrate with muleSpring security integrate with mule
Spring security integrate with mule
Son Nguyen
 
Dataweave types operators
Dataweave types operatorsDataweave types operators
Dataweave types operators
Ramakrishna kapa
 
Dataweave
DataweaveDataweave
Dataweave
Bhoopal Kante
 
Operators in mule dataweave
Operators in mule dataweaveOperators in mule dataweave
Operators in mule dataweave
Ramakrishna kapa
 
Mule with workday connectors
Mule with workday connectorsMule with workday connectors
Mule with workday connectors
Son Nguyen
 
Anypoint connectors
Anypoint connectorsAnypoint connectors
Anypoint connectors
Son Nguyen
 
Mule integrate with microsoft
Mule integrate with microsoftMule integrate with microsoft
Mule integrate with microsoft
Son Nguyen
 

Viewers also liked (20)

Composite source in bound and out-bound
Composite source in bound and out-boundComposite source in bound and out-bound
Composite source in bound and out-bound
 
Jms queue
Jms queueJms queue
Jms queue
 
Using message enricher
Using message enricherUsing message enricher
Using message enricher
 
Message processor in mule
Message processor in muleMessage processor in mule
Message processor in mule
 
Google drive connection
Google drive connectionGoogle drive connection
Google drive connection
 
Using map and list starter
Using map and list starterUsing map and list starter
Using map and list starter
 
Batch job processing
Batch job processingBatch job processing
Batch job processing
 
Expression language in mule
Expression language in muleExpression language in mule
Expression language in mule
 
Mule flow overview
Mule flow overviewMule flow overview
Mule flow overview
 
Android intergrate with mule
Android intergrate with muleAndroid intergrate with mule
Android intergrate with mule
 
Wsdl connector introduction
Wsdl connector introductionWsdl connector introduction
Wsdl connector introduction
 
Mule flow and filter
Mule flow and filterMule flow and filter
Mule flow and filter
 
Handle exceptions in mule
Handle exceptions in muleHandle exceptions in mule
Handle exceptions in mule
 
Spring security integrate with mule
Spring security integrate with muleSpring security integrate with mule
Spring security integrate with mule
 
Dataweave types operators
Dataweave types operatorsDataweave types operators
Dataweave types operators
 
Dataweave
DataweaveDataweave
Dataweave
 
Operators in mule dataweave
Operators in mule dataweaveOperators in mule dataweave
Operators in mule dataweave
 
Mule with workday connectors
Mule with workday connectorsMule with workday connectors
Mule with workday connectors
 
Anypoint connectors
Anypoint connectorsAnypoint connectors
Anypoint connectors
 
Mule integrate with microsoft
Mule integrate with microsoftMule integrate with microsoft
Mule integrate with microsoft
 

Similar to Mule with data weave

Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200
harika thamishetti
 
Oracle9i reports developer
Oracle9i reports developerOracle9i reports developer
Oracle9i reports developer
FITSFSd
 
Intro to Talend Open Studio for Data Integration
Intro to Talend Open Studio for Data IntegrationIntro to Talend Open Studio for Data Integration
Intro to Talend Open Studio for Data Integration
Philip Yurchuk
 
Data weave documentation
Data weave documentationData weave documentation
Data weave documentation
Khadhar Koneti
 
Linq to sql
Linq to sqlLinq to sql
Linq to sql
Muhammad Younis
 
Examples from Pune meetup
Examples from Pune meetupExamples from Pune meetup
Examples from Pune meetup
Santosh Ojha
 
Mule ESB Components
Mule ESB Components Mule ESB Components
Mule ESB Components
pat_91
 
Mule connectors-session1
Mule connectors-session1Mule connectors-session1
Mule connectors-session1
Vishnukanth Rachineni
 
My 70-480 HTML5 certification learning
My 70-480 HTML5 certification learningMy 70-480 HTML5 certification learning
My 70-480 HTML5 certification learning
Syed Irtaza Ali
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
Mike Willbanks
 
Data weave
Data weaveData weave
Data weave
manavp
 
Warsaw Frontend Meetup #1 - Webpack
Warsaw Frontend Meetup #1 - WebpackWarsaw Frontend Meetup #1 - Webpack
Warsaw Frontend Meetup #1 - Webpack
Radosław Rosłaniec
 
Jsp and jstl
Jsp and jstlJsp and jstl
Jsp and jstl
vishal choudhary
 
JSON Logger Baltimore Meetup
JSON Logger Baltimore MeetupJSON Logger Baltimore Meetup
JSON Logger Baltimore Meetup
ManjuKumara GH
 
Data weave
Data weave Data weave
Data weave
princeirfancivil
 
Data weave
Data weave Data weave
Data weave
Phaniu
 
Dataweave
Dataweave Dataweave
Dataweave
Praneethchampion
 

Similar to Mule with data weave (20)

Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200
 
Oracle9i reports developer
Oracle9i reports developerOracle9i reports developer
Oracle9i reports developer
 
treeview
treeviewtreeview
treeview
 
treeview
treeviewtreeview
treeview
 
Intro to Talend Open Studio for Data Integration
Intro to Talend Open Studio for Data IntegrationIntro to Talend Open Studio for Data Integration
Intro to Talend Open Studio for Data Integration
 
Html JavaScript and CSS
Html JavaScript and CSSHtml JavaScript and CSS
Html JavaScript and CSS
 
Data weave documentation
Data weave documentationData weave documentation
Data weave documentation
 
Linq to sql
Linq to sqlLinq to sql
Linq to sql
 
Examples from Pune meetup
Examples from Pune meetupExamples from Pune meetup
Examples from Pune meetup
 
Mule ESB Components
Mule ESB Components Mule ESB Components
Mule ESB Components
 
Mule connectors-session1
Mule connectors-session1Mule connectors-session1
Mule connectors-session1
 
My 70-480 HTML5 certification learning
My 70-480 HTML5 certification learningMy 70-480 HTML5 certification learning
My 70-480 HTML5 certification learning
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
Data weave
Data weaveData weave
Data weave
 
Warsaw Frontend Meetup #1 - Webpack
Warsaw Frontend Meetup #1 - WebpackWarsaw Frontend Meetup #1 - Webpack
Warsaw Frontend Meetup #1 - Webpack
 
Jsp and jstl
Jsp and jstlJsp and jstl
Jsp and jstl
 
JSON Logger Baltimore Meetup
JSON Logger Baltimore MeetupJSON Logger Baltimore Meetup
JSON Logger Baltimore Meetup
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Dataweave
Dataweave Dataweave
Dataweave
 

More from Son Nguyen

Using spring scheduler mule
Using spring scheduler muleUsing spring scheduler mule
Using spring scheduler mule
Son Nguyen
 
Finance connectors with mule
Finance connectors with muleFinance connectors with mule
Finance connectors with mule
Son Nguyen
 
Using properties in mule
Using properties in muleUsing properties in mule
Using properties in mule
Son Nguyen
 
Mule esb basic introduction
Mule esb basic introductionMule esb basic introduction
Mule esb basic introduction
Son Nguyen
 
Runing batch job in mule
Runing batch job in muleRuning batch job in mule
Runing batch job in mule
Son Nguyen
 
Mule integration with cloud hub
Mule integration with cloud hubMule integration with cloud hub
Mule integration with cloud hub
Son Nguyen
 
Idempotent filter with mule
Idempotent filter with muleIdempotent filter with mule
Idempotent filter with mule
Son Nguyen
 
Mule enterprise service introduction
Mule enterprise service introductionMule enterprise service introduction
Mule enterprise service introduction
Son Nguyen
 
Accessing jms by groovy
Accessing jms by groovyAccessing jms by groovy
Accessing jms by groovy
Son Nguyen
 
Executing oracle ebs stored
Executing oracle ebs storedExecuting oracle ebs stored
Executing oracle ebs stored
Son Nguyen
 
Mule batch introduction
Mule batch introductionMule batch introduction
Mule batch introduction
Son Nguyen
 
Adding dynamic file
Adding dynamic fileAdding dynamic file
Adding dynamic file
Son Nguyen
 
Create folder in microsoft share point
Create folder in microsoft share pointCreate folder in microsoft share point
Create folder in microsoft share point
Son Nguyen
 

More from Son Nguyen (13)

Using spring scheduler mule
Using spring scheduler muleUsing spring scheduler mule
Using spring scheduler mule
 
Finance connectors with mule
Finance connectors with muleFinance connectors with mule
Finance connectors with mule
 
Using properties in mule
Using properties in muleUsing properties in mule
Using properties in mule
 
Mule esb basic introduction
Mule esb basic introductionMule esb basic introduction
Mule esb basic introduction
 
Runing batch job in mule
Runing batch job in muleRuning batch job in mule
Runing batch job in mule
 
Mule integration with cloud hub
Mule integration with cloud hubMule integration with cloud hub
Mule integration with cloud hub
 
Idempotent filter with mule
Idempotent filter with muleIdempotent filter with mule
Idempotent filter with mule
 
Mule enterprise service introduction
Mule enterprise service introductionMule enterprise service introduction
Mule enterprise service introduction
 
Accessing jms by groovy
Accessing jms by groovyAccessing jms by groovy
Accessing jms by groovy
 
Executing oracle ebs stored
Executing oracle ebs storedExecuting oracle ebs stored
Executing oracle ebs stored
 
Mule batch introduction
Mule batch introductionMule batch introduction
Mule batch introduction
 
Adding dynamic file
Adding dynamic fileAdding dynamic file
Adding dynamic file
 
Create folder in microsoft share point
Create folder in microsoft share pointCreate folder in microsoft share point
Create folder in microsoft share point
 

Recently uploaded

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
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
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 

Recently uploaded (20)

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
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
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 

Mule with data weave

  • 2. • Data transformation is an inevitable component of connectivity, as most systems don’t speak the same language. Even when the format is similar, as when two RESTful Web APIs exchange JSON payloads, their message structure typically differs, making translation a necessity.
  • 3. • Calling Global MEL Functions from DataWeave Code : o If you define a global Mule Expression Language (MEL) function in your Mule project, you can then invoke it anywhere in your DataWeave code, without need for any special syntax. o To create one such global function, you must edit your Mule project’s XML file and enclose any functions that you wish to define in the following set of tags <configuration doc:name="Configuration"> <expression-language> <global-functions> </global-functions> </expression-language> </configuration> DataWeave – Body
  • 4. • Calling Global MEL Functions from DataWeave Code : oThis global MEL function must be placed in the global elements section, before any of the flows are defined. oIn the empty space in the tags shown in previous slide, you can use any MEL expression to define custom functions. oExample : <configuration doc:name="Configuration"> <expression-language> <global-functions> def newUser() { return ["name" : "mariano"] } def upperName(user) { return user.name.toUpperCase() } </global-functions> </expression-language> </configuration> DataWeave – Body
  • 5. • Calling Global MEL Functions from DataWeave Code : o With the MEL global function in place, in the DataWeave code of your Transform Message element you can just refer to these functions. o Note that the inputs and outputs of these functions can even be objects and arrays. o Example : %dw 1.0 %output application/json --- { "foo" : newUser(), "bar": upperName(newUser()) } o Even with these external functions in place, you should be able to preview the output of this transform, updated in real time as you edit it. DataWeave – Body
  • 6. • Read : o The read function returns the result of parsing the content parameter with the specified mimeType reader. o It accepts three parameters : • The first argument points the content that must be read. • The second is the format in which to write it. • A third optional argument lists reader configuration properties. o Example : o In the example above, what was in the CDATA element isn’t parsed by the DataWeave reader by default, that’s why the read operator must be used to interpret it. DataWeave – Body Transform Input Output %dw 1.0 %output application/xml --- output: read(payload.root.xmlblock, "application/xml").foo <?xml version='1.0' encoding='UTF- 8'?> <root> <xmlblock><![CDATA[<foo>bar</foo>] ]></xmlblock> </root> <?xml version='1.0' encoding='UTF-8'?> <output>bar</output>
  • 7. • Write : o The write function returns a string with the serialized representation of the value in the specified mimeType. o It accepts three parameters : • The first argument points to the element that must be written. • the second is the format in which to write it. • A third optional argument lists writer configuration properties. o Example : DataWeave – Body Transform Input Output %dw 1.0 %output application/xml --- { output: write(payload, "application/csv", {"separator" : "|"}) } "Name": "Mr White", "Email": "white@mulesoft.com", "Id": "1234", "Title": "Chief Java Prophet" }, { "Name": "Mr Orange", "Email": "orange@mulesoft.com", "Id": "4567", "Title": "Integration Ninja" } ] <?xml version='1.0' encoding='US- ASCII'?> <output>Name|Email|Id|Title Mr White|white@mulesoft.com|1234|Chief Java Prophet Mr Orange|orange@mulesoft.com|4567|Inte gration Ninja </output>
  • 8. • Log : o Returns the specified value and also logs the value in the DataWeave representation with the specified prefix. o Example : o Note that besides producing the expected output, it also logs it. DataWeave – Body Transform Output Output To Logger %dw 1.0 %output application/json --- { result: log("Logging the array",[1,2,3,4]) } { "result": [1,2,3,4] } Logging the array [1,2,3,4]
  • 9. • Calling External Flows oyou can trigger the calling of a different flow in your Mule application from a DataWeave transform, through the following expression: lookup(“flowName”,$) Which takes two parameters: • The name of the flow that must be called • The payload to send to this flow, as a map DataWeave – Body –External Flows
  • 10. • Calling External Flows oExample : onote that only the payload returned by the invoked flow will be assigned (i.e. all other message’s properties such as flowVars and sessionVars will not be overridden when using the lookup function). oThe lookup function does not support calling subflows. DataWeave – Body –External Flows Transform Mule Flow Output %dw 1.0 %output application/json --- { a: lookup("mySecondFlow",{b:"Hello"}) } <flow name="mySecondFlow"> <set-payload doc:name="Set Payload" value="#[payload.b + ' world!' ]"/> </flow> { "a": "Hello world!" }