Professional Documents
Culture Documents
Mule SOft For AB
Mule SOft For AB
Mule SOft For AB
SESSION 1
What is
Mulesoft
MULESOFT
TRAINING
FOR
ABSOLUTE BEGINNERS
Pre-Requisites / FAQ’s
‣ Why only for Absolute Beginners
‣ Do we need to know languages like Java, .net etc?
‣ Am from QA,Linux , xyz background , Can I learn MuleSoft ?
‣ What’s the best CTC that I can ask?
‣ What should we learn and best to know before starting of session?
‣ Practice Practice Practice - No Shortcuts
‣ Official Training Details
WHAT IS MULESOFT
-Design API’s
-Develop API’s
-Deploy API’s
-Manage API’s
-Secure API’s
-Reuse API’s
WHAT IS AN API?
Response
Restaurant Example
SOAP REST
•System API’s are built to connect through underlying systems (Any system
which contains the raw data) .
•Process API’s are built to compose or combine two or more System API’s
•Usually to do any kind of transformation or to implement any kind of
business logics or shape the data out of system apis.
•It may perform aggregation / splitting / routing the data.
•Process APIs must be private and should not be exposed to public for use.
•Eg: Aggregating Customer Data and Product Data that comes from 2 system
APIs where Actual data is originated , to provide Order Status.
EXPERIENCE APIS
•These are API’s which are a kind of a wrapper either to Process API’s (if
present ) or to System API’s , so that Client/Consumers can use it.
•Client/Consumers will not have exposure or contact with direct Raw Data.
•We can have minimal Data Transformation like the final result to be in JSON
or XML or whatever the consumer wants to have.
Pre-Booked flight
Process Payment Send Notification
Status
Process APIs
SRAVAN LINGAM
Anypoint Platform
One Stop platform for APIs and integrations :
‣ Design Center - Design and Develop API’s
‣ Anypoint Exchange - Place where we will be able to share, discover api’s and reusable assets
‣ API Manager - Helps in Managing APIs by invoking policies
‣ Runtime Manager - Where Applications are deployed
‣ Access Management - Configures Access and permissions within organization
‣ Anypoint Monitoring/Visualizer -Provides Monitoring and real-time graphical representation
of APIs
‣ Secret Manager - Place to store and control access to private keys, passwords, certificates,
etc
Pre-Requisites / FAQ’s
‣ Training and certification Platform
‣ Anypoint Platform Account
‣ help.mulesoft.com
‣ What is MuleSoft 3D
MuleSoft Community
• MuleSoft Meetups - https://meetups.mulesoft.com
• MuleSoft CONNECT NOW: https://connect.mulesoft.com
• Training & Certification
• MuleSoft Blogs and many more.
• Tip : Learn from errors!
In case if you missed the session!
Subscribe To our YouTube Channels:
SESSION 2
Designing API’s
MULESOFT
TRAINING
FOR
ABSOLUTE BEGINNERS
Recap of Session 1
➡ What is MuleSoft?
➡ What is an API?
➡ Anypoint Platform
➡ MuleSoft 3D
➡ Walkthrough to a website
➡ At the end of session, you will be asked to submit assignment by next Saturday
What is API Specification?
SRAVAN LINGAM
DESIGNING APIS
Hands-on
WHAT HAVE WE COVERED SO FAR!
Mule
Mule Message
Message Mule
Mule Event
Event
Payload
Outbound properties
+
Attributes
Payload
Variables
(flow,session,record)
Variables
Attachments
Mule
Mule 3
3 Mule
Mule 4
4
✦ Payload : It’s the actual message content. Payload can be over ridden
Mule Palette
Project/Pack
Canvas
age explorer
Console and
other stuff
MULE PROJECT STRUCTURE
➡Every Project in Mule 4 is Mavenized Project
➡All Mule xml’s are placed under src/main/mule
➡Other files can be placed under : src/main/resources or
src/test/resources
➡mule-artifact.json
➡Each Mule app xml has - Message flow (Graphical
view) , Global elements(contains all config details)
,configuration xml (xml version of graphical view)
FLOW , SUB-FLOW AND PRIVATE FLOW
➡Error Handling for sub-flows are handled by the calling flow/private flow.
CONNECTORS
HTTP
LISTENER:
s - o n
Ha nd
SET PAYLOAD
ds - o n
Ha n
BUILDING A RESTFUL API
Hands-on
DEBUGGING AN APPLICATION
Hands-on
WHAT HAVE WE COVERED SO FAR!
ds - o n
Ha n
SRAVAN LINGAM
ATTRIBUTES
Mule 4 has only one kind of variable called “variable” where in Mule 3
we used to have 3 kinds of variables (flow, session and record) .
They are used to preserve information which you think might be useful
at any point of flow.
Accessed as #[vars.id]
Vars are carried as long as the flow is connected. If you think that you
SRAVAN LINGAM
no longer need the variable, you can use “remove variable” to remove it.
SET VARIABLE
SRAVAN LINGAM
SCOPE OF ATTRIBUTES , PAYLOAD AND VARIABLES
TRANSFORM
MESSAGE
Mandatory Config Details required: Should
have something written.
You can set a payload, variable or attribute using
Transform message.
You can set Multiple variables along with payload.
Best practise is to define output type
Default : output application/java - - - { }
SRAVAN LINGAM
TRANSFROM
MESSAGE
s - o n
Ha nd
SRAVAN LINGAM
LOGGER
SRAVAN LINGAM
CONFIGURATION PROPERTIES
Property values are used for best practices to extract some values from
property files using corresponding key to avoid Hardcoding values
We can extract property values from property file by two ways , either by ${}
or p(' ') .
p(' ') can only be used in DataWeave expression Language scope. i.e, within #[]
s - o n
Remember : Either of the cases , we have to restart the application if there are any
d
Ha
changes made in property file to get the new values reflected
SRAVAN LINGAM
n
WHAT HAVE WE COVERED SO FAR!
MULESOFT
TRAINING
FOR
ABSOLUTE BEGINNERS
DATAWEAVE - 2.0
•We can Transform Data from one format to other . Eg: JSON to XML
•We can access any specific field inside a payload. Eg: payload.name
SRAVAN LINGAM
DATAWEAVE - THE POWER OF PREVIEW FEATURE
•Are you not sure about the syntax you want to write?
SRAVAN LINGAM
UNDERSTANDING ARRAY AND OBJECT
SRAVAN LINGAM
UNDERSTANDING ARRAY AND OBJECT
•Eg:
• [“Sravan” , “2” ,”MuleSoft”]
ds - o n
•{ “name” : [“Sravan”, “Lingam”]}
•[“name” : “Sravan”] Ha n
SRAVAN LINGAM
TRANSFORMING ONE DATA TYPE TO OTHER
•In Mule 3 ,we have separate connectors to convert from one type to other.
•Eg :
ds - o n
•JSON to XML
•XML to JSON Ha n
•JSON to CSV
•And many more…..
SRAVAN LINGAM
MAP AND MAP OBJECT
flatten On arrays Single set of Array Turns into set of subarrays to single array
CANNOT COERCE - ERRORS
•Null checks
•Default
• Converting String to Number, Number to String
•Very Important while developing
d s - on
Ha n
SRAVAN LINGAM
DATAWEAVE IN OTHER COMPONENTS
•Do you know how to add multiple variables and attributes in Transform
message?
SRAVAN LINGAM
DATAWEAVE - INPUT OUTPUT MAPPING
•DW syntax is auto generated when we manually map Sample input with
Sample Output.
s - o n
Ha nd
SRAVAN LINGAM
DATAWEAVE - FUNCTIONS
•You can also Write your DataWeave in separate scripts and call them!
d s - o n
Ha n
SRAVAN LINGAM
WHAT HAVE WE COVERED SO FAR!
•What is DataWeave
•DataWeave -preview
•Array & Object Identification
•Map and MapObject , $ , $$
•Pluck,flatten,reduce,if-else,upper,filter,groupBy,orderBy
•How to write DataWeave in other components
•How to map using Drag and drop fields to build syntaxes
•Local variables
•Various inbuilt functions/ custom functions
•Calling using lookup, calling dw scripts etc
IMPORTANT THINGS!
SRAVAN LINGAM
HTTP
REQUEST:
d s - o n
Ha n
SRAVAN LINGAM 85
85
CHOICE
Output payload is combination of all targets. And each target output has
payload+attributes.
SRAVAN LINGAM
SCATTER - GATHER
So its always best practice to wrap every target within Try-Block with
On-Error-Continue , So that you can handle the errors and complete the
process successfully .
The total time taken to process all targets is the max time took by one of
the targets
SRAVAN LINGAM
SCATTER - GATHER
ds - o n
Ha n
SRAVAN LINGAM
VALIDATION
If Database Select doesn't return any rows , we receive an Empty Array instead of
SRAVAN LINGAM
null payload
DATABASE
d s - o n
Ha n
SRAVAN LINGAM
FILE
SRAVAN LINGAM
FILE
d s - o n
Ha n
SRAVAN LINGAM
SFTP/FTP