You are on page 1of 10

5/22/19

Anypoint Platform Development:


DataWeave

Student introductions

• Your name
• Company, role, and location
• Training courses you have taken
• Experience with
– Anypoint Studio
– Anypoint Platform

• Your main objectives for the class

All contents © M uleSoft Inc. 3

1
5/22/19

Course logistics

• Time
– 2 days
– 1 hour lunch/mid-class break each day
– 15 minute break each morning and afternoon

• We know you have two jobs to do this week!


– If you have scheduled meetings, please let me know
• We can try to schedule breaks around them

All contents © M uleSoft Inc. 4

Using WebEx

2
5/22/19

Using WebEx

• Locate the Participants Panel and Chat Panel


– Menu drops down from top of your screen
– Participants Panel and Chat Panel are hidden every time someone shares
their desktop
• Give feedback

Feedback options

All contents © M uleSoft Inc. 6

Managing your WebEx audio

• Use an external headset/microphone to avoid feedback


• Mute your microphone when you are not talking

All contents © M uleSoft Inc. 7

3
5/22/19

Sharing your desktop

• Click Share My Desktop or use the Share menu


• Drag the WebEx ball back to the instructor when you are finished

(2) Drag WebEx ball


back to Host

(1) Click here to share


your Desktop

All contents © M uleSoft Inc. 8

Recommendations for the walkthroughs

• Use a second monitor to watch the WebEx session while you work

All contents © M uleSoft Inc. 9

4
5/22/19

Introducing the course

Course goal

• Extend the skills you gained in the Development Fundamentals


course to write more complex and powerful transformations that
are not possible with the drag-and-drop GUI

Join data Transform, Format, Reorder, Recurse

All contents © M uleSoft Inc. 11

5
5/22/19

Course objectives

• Write generalized and reusable transformations using variables,


functions, DataWeave modules and mappings, and dynamic
evaluation components
• Build up complex transformations from smaller testable steps
• Build more robust and testable functions and expressions using
strong typing, match operators, error handling, and logging
• Create, transform, filter, combine, reorder, select from, map,
and reduce complex data structures that include nested arrays,
nested objects, and arrays of objects
• Recursively replace or format every element or a list of elements
in a nested schema

All contents © M uleSoft Inc. 12

Course prerequisites

• You should have taken the Development Fundamentals course and


already know how to
– Create, code, and debug Mule projects in Anypoint Studio
– Use basic event processors including HTTP, File, Set Payload, Set Variable,
Logger, and Choice router
– Write DataWeave transformations for basic XML, JSON, and Java
transformations
– Store DataWeave transformations in external files
– Write DataWeave transformations for complex data structures with repeated
elements
– Coerce and format strings, numbers, and dates
– Use DataWeave operators
– Define and use custom data types
– Call Mule flows from DataWeave transformations
All contents © M uleSoft Inc. 13

6
5/22/19

How the course will work

• Is primarily hands-on

• Consists of
– Short lectures (PPT) to introduce a concept
– Walkthroughs
• The bulk of class
• Exercises we do together to learn the content

All contents © M uleSoft Inc. 14

Course materials

• Available on the MuleSoft Learning Management System


– http://training.mulesoft.com/login.html

• Student files (ZIP)


– Starting files needed to complete some of the exercises
– Solution files

• Student manual (PDF) with steps for walkthroughs

• Course slides (ZIP of PDFs)

All contents © M uleSoft Inc. 15

7
5/22/19

Walkthrough: Set up your computer for class

• Download the course files from the MuleSoft Training Learning


Management System
• Make sure you have JDK 1.8 and that it is included in your PATH
environment variable
• Make sure Anypoint Studio starts successfully
• Install Advanced Rest Client (if you did not already)

All contents © M uleSoft Inc. 16

Introducing the course use


case: Mule United Airport

8
5/22/19

Reviewing the Development Fundamentals case


study

• The Development Fundamentals course used the Mule United Airport


use case
• In those Mule applications, requests are made to look up flights on
American, Delta, and United airlines to various destination cities
• DataWeave transformations convert responses from each airline's
REST or SOAP service to common Java objects
– Each airline response is mapped to a different data structure
– Some keys are renamed
– Some values are formatted in different ways
• The results are flattened into one array of flight objects

All contents © M uleSoft Inc. 18

Introducing the DataWeave course case study

• The course starter project is based on the Development


Fundamentals Mule United Airport solution, but does not require any
external connectivity
– Responses from the three airline online services are mocked and hard-coded
inside the Mule application in files and DataWeave variables

• This course performs additional data transformation to the


flattened array of flight responses
– Airport details are joined with flights
– Key/values inside flights are reordered and modified "in-place"

• Schema used in the course includes more complex objects with


nested objects and arrays of objects
• Some walkthroughs cover more general topics and do not use the
Mule United Airport use case
All contents © M uleSoft Inc. 19

9
5/22/19

Types of data transformations you will code

• Convert child arrays to objects


• Use functions to filter and transform complex input data in more
testable stages
• Join two schema together and reorder the elements
• Write recursive functions to reorder, format, and transform descendent
elements Join data Transform, format, reorder, recurse

All contents © M uleSoft Inc. 20

Course outline

• Module 1: Applying DataWeave Fundamentals

• Module 2: Organizing and Reusing DataWeave Code

• Module 3: Writing defensive and robust DataWeave

• Module 4: Constructing Arrays and Objects

• Module 5: Operating upon Arrays and Objects

• Module 6: Iteratively and Recursively Mapping Data

• Module 7: Reducing Data from Arrays


All contents © M uleSoft Inc. 21

10

You might also like