SlideShare a Scribd company logo
1 of 26
2 Oct, 2022 5 PM MYT
Selangor, Malaysia Meetup
Agenda
•Introduction Of Organizers and Speakers
•Community Details!
•Integration with Local SFTP Server(RebexTinySftpServerBin-1.0.6)
•Dataweave Concepts
•Q & A
•Trivia Quiz
2
Selangor, Malaysia Meetup Leader
3
Sr. Associate , Cognizant
Speaker for the day!
4
PADMA BANDI
Cognizant
Sr. Integration Developer
Community Details
•Register for Meetups : https://meetups.mulesoft.com
•Register for Official Training platform : https://training.mulesoft.com
•MuleSoft forum : https://help.mulesoft.com
•For all blogs : https://blogs.mulesoft.com/
•Anypoint platform : https://anypoint.mulesoft.com
5
Padma Bandi
Sr.Integration Developer
Local SFTP Setup & Dataweave
2
Agenda
• SFTP – Local Setup
• Demonstration of using RebexTinySftpServerBin
• Dataweave Concepts
a. String Interpolation
b. ndjson
b. Recursive functions with match case
d. firstWith
2
SFTP Local Setup
Usual Problems to connect to SFTP :
● Appropriate permissions.
● Waiting time for installation of test SFTP server.
● Difficulty to unit test code.
● Back and forth code changes to test with alternative
connectors.
Solution :
● Setup the local SFTP server.
● No change required to alter the code with alternative
connectors
● One such server is Rebex tiny SFTP Server .
2
SFTP Local Setup
Rebex Tiny SFTP Server:
● Small minimalist, single-user
SFTP server for testing
purposes.
● Runs as a windows application.
● Just unzip and run ,
no installation needed.
https://www.rebex.net/tiny-sftp-server/
2
SFTP Local Setup
Steps for connecting to Rebex Tiny SFTP from Mulesoft:
● Download and unpack the zip package.
https://www.rebex.net/tiny-sftp-server/#download
● Edit the config file with your username, password and root
directory details.
2
SFTP Local Setup
● Add your flow in the Anypoint studio with SFTP connector
configuration.
2
SFTP Local Setup
● Start your Rebex tiny SFTP server application and then test
your SFTP connector configuration.
13
Dataweave
● Dataweave is a simple powerful tool used to query and
transform data inside Mule.
● It is a powerful engine that allows to transform data to and
from any kind if formats like JSON, XML, CSV, Pojos etc..
● This is a functional programming language designed for
transforming data.
14
Dataweave : String Interpolation
● String interpolation is the process of evaluating a string literal
containing one or more placeholders, yielding a result in
which the placeholders are replaced by the corresponding
values.
● In simple words, it’s an alternative to concatenation in a
simpler way without using quoting and unquoting.
15
Dataweave : ndjson
● ndjson : Newline Delimited JSON format.
● Usage : Most log formats like elastic search queries uses the
ndjson formats.
● Dataweave helps in the transformations with ndjson
● ndjson reader ignores all lines of ndjson data that are invalid
if skipInvalid=true
● MIME TYPE : application/x-ndjson
● Each line of ndjson is mapped to one object in the array
Example ndjson:
{"name": “David","lastName": “Ross"}
{"name": "Mariano","lastName": “Dekker"}
16
Dataweave : ndjson
● Sample scenario of using ndjson:
To bulk update the records in an elastic index we use the ndjson format with the below
query:
Sample input JSON:
[{"id": "12345","empName": "David", "department" : "finance", "role": "TL"},
{"id": "123456","empName": "Kiran", "department": "payroll", "role": “TL"}
]
POST my_elastic_index/_bulk
{"update": {"_id": " 12345 "}}
{"doc": {"empName": " David","department": "finance","role": "TL"},"doc_as_upsert":
true}
{"update": {"_id": "00010783625"}}
{"doc": {"empName": "Kiran","department": "payroll","role": “TL"},"doc_as_upsert":
17
Dataweave : Match case
● Instead of using multiple if and else condition we can use a
match case to determine the respective output.
● It behaves just as the switch statement in another languages.
Syntax:
inputExpression match {
case <condition> -> <routing expression>
case <condition> -> <routing expression>
else -> <default routing expression>
}
18
Dataweave : Match case
19
Dataweave : Recursion with Match case
● A recursive function solves a particular problem by calling a copy
of itself.
● It’s a technique of making a function call itself.
● Scenarios :
a. We want to check for null values and recursively replace with “”
b. Wherever the number exists in the input payload change to 5
digit number recursively
c. Make all the first letters of the entire payload values to capital
Letters using recursion
d. Map to Key recursively
20
Dataweave : Creating reusable functions
● A reusable code is the best standards of any programming
language.
● If a function can be reused at multiple places, defining it as
common function and calling at various flows makes the life
easier.
● For example , let’s see the conversion of string to decimals
and try to make it as a reusable function.
“1234.567” as Number as String {format: “0.00”} -> “1234.56”
If in another mapper we want the same function but with 3
decimal digits and in another with 4 digits and so on…
21
Dataweave : firstWith
● firstWith returns the first element that satisfies the condition.
● This is similar to filter condition, but it stops at the first element that
satisfies the condition.
● Performance of firstWith may vary with filter.
22
Dataweave : cumulative Additions using Reduce
● Let us see how to add cumulatively the number of quantities using
the reduce function.
Questions ?
Trivia Quiz !
Enter Your Full Valid Name (no nick Names are allowed)
Only those who have registered and joined the session will be
allowed!
1. Go to Browser
Enter :
quizizz.com/join
2. Wait for code
3. Enter your name
Thank you

More Related Content

Similar to Meetup-presentation-Oct2.pptx

Next Gen Data Modeling in the Open Data Platform With Doron Porat and Liran Y...
Next Gen Data Modeling in the Open Data Platform With Doron Porat and Liran Y...Next Gen Data Modeling in the Open Data Platform With Doron Porat and Liran Y...
Next Gen Data Modeling in the Open Data Platform With Doron Porat and Liran Y...
HostedbyConfluent
 
Admin2012 buchan web_services-v101
Admin2012 buchan web_services-v101Admin2012 buchan web_services-v101
Admin2012 buchan web_services-v101
Bill Buchan
 

Similar to Meetup-presentation-Oct2.pptx (20)

The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
 
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
 
Microservice-based software architecture
Microservice-based software architectureMicroservice-based software architecture
Microservice-based software architecture
 
Python Ireland Conference 2016 - Python and MongoDB Workshop
Python Ireland Conference 2016 - Python and MongoDB WorkshopPython Ireland Conference 2016 - Python and MongoDB Workshop
Python Ireland Conference 2016 - Python and MongoDB Workshop
 
Next Gen Data Modeling in the Open Data Platform With Doron Porat and Liran Y...
Next Gen Data Modeling in the Open Data Platform With Doron Porat and Liran Y...Next Gen Data Modeling in the Open Data Platform With Doron Porat and Liran Y...
Next Gen Data Modeling in the Open Data Platform With Doron Porat and Liran Y...
 
Working with JSON Data in PostgreSQL vs. MongoDB
Working with JSON Data in PostgreSQL vs. MongoDBWorking with JSON Data in PostgreSQL vs. MongoDB
Working with JSON Data in PostgreSQL vs. MongoDB
 
MongoDB World 2018: Tutorial - Free the DBA: Building Chat Bots to Triage, Mo...
MongoDB World 2018: Tutorial - Free the DBA: Building Chat Bots to Triage, Mo...MongoDB World 2018: Tutorial - Free the DBA: Building Chat Bots to Triage, Mo...
MongoDB World 2018: Tutorial - Free the DBA: Building Chat Bots to Triage, Mo...
 
NoSql evaluation
NoSql evaluationNoSql evaluation
NoSql evaluation
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
 
Introducción a NoSQL
Introducción a NoSQLIntroducción a NoSQL
Introducción a NoSQL
 
Real time analytics on deep learning @ strata data 2019
Real time analytics on deep learning @ strata data 2019Real time analytics on deep learning @ strata data 2019
Real time analytics on deep learning @ strata data 2019
 
Unit 3
Unit 3Unit 3
Unit 3
 
New York City Meetup- 6th March 2021
New York City Meetup- 6th March 2021New York City Meetup- 6th March 2021
New York City Meetup- 6th March 2021
 
nodejs.pptx
nodejs.pptxnodejs.pptx
nodejs.pptx
 
Neo4j graph database
Neo4j graph databaseNeo4j graph database
Neo4j graph database
 
MongoDB 4.0 새로운 기능 소개
MongoDB 4.0 새로운 기능 소개MongoDB 4.0 새로운 기능 소개
MongoDB 4.0 새로운 기능 소개
 
From sql server to mongo db
From sql server to mongo dbFrom sql server to mongo db
From sql server to mongo db
 
Admin2012 buchan web_services-v101
Admin2012 buchan web_services-v101Admin2012 buchan web_services-v101
Admin2012 buchan web_services-v101
 
polystore_NYC_inrae_sysinfo2021-1.pdf
polystore_NYC_inrae_sysinfo2021-1.pdfpolystore_NYC_inrae_sysinfo2021-1.pdf
polystore_NYC_inrae_sysinfo2021-1.pdf
 

Recently uploaded

Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
Overkill Security
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
Muhammad Subhan
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
Wonjun Hwang
 

Recently uploaded (20)

Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistan
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
 

Meetup-presentation-Oct2.pptx

  • 1. 2 Oct, 2022 5 PM MYT Selangor, Malaysia Meetup
  • 2. Agenda •Introduction Of Organizers and Speakers •Community Details! •Integration with Local SFTP Server(RebexTinySftpServerBin-1.0.6) •Dataweave Concepts •Q & A •Trivia Quiz 2
  • 3. Selangor, Malaysia Meetup Leader 3 Sr. Associate , Cognizant
  • 4. Speaker for the day! 4 PADMA BANDI Cognizant Sr. Integration Developer
  • 5. Community Details •Register for Meetups : https://meetups.mulesoft.com •Register for Official Training platform : https://training.mulesoft.com •MuleSoft forum : https://help.mulesoft.com •For all blogs : https://blogs.mulesoft.com/ •Anypoint platform : https://anypoint.mulesoft.com 5
  • 7. 2 Agenda • SFTP – Local Setup • Demonstration of using RebexTinySftpServerBin • Dataweave Concepts a. String Interpolation b. ndjson b. Recursive functions with match case d. firstWith
  • 8. 2 SFTP Local Setup Usual Problems to connect to SFTP : ● Appropriate permissions. ● Waiting time for installation of test SFTP server. ● Difficulty to unit test code. ● Back and forth code changes to test with alternative connectors. Solution : ● Setup the local SFTP server. ● No change required to alter the code with alternative connectors ● One such server is Rebex tiny SFTP Server .
  • 9. 2 SFTP Local Setup Rebex Tiny SFTP Server: ● Small minimalist, single-user SFTP server for testing purposes. ● Runs as a windows application. ● Just unzip and run , no installation needed. https://www.rebex.net/tiny-sftp-server/
  • 10. 2 SFTP Local Setup Steps for connecting to Rebex Tiny SFTP from Mulesoft: ● Download and unpack the zip package. https://www.rebex.net/tiny-sftp-server/#download ● Edit the config file with your username, password and root directory details.
  • 11. 2 SFTP Local Setup ● Add your flow in the Anypoint studio with SFTP connector configuration.
  • 12. 2 SFTP Local Setup ● Start your Rebex tiny SFTP server application and then test your SFTP connector configuration.
  • 13. 13 Dataweave ● Dataweave is a simple powerful tool used to query and transform data inside Mule. ● It is a powerful engine that allows to transform data to and from any kind if formats like JSON, XML, CSV, Pojos etc.. ● This is a functional programming language designed for transforming data.
  • 14. 14 Dataweave : String Interpolation ● String interpolation is the process of evaluating a string literal containing one or more placeholders, yielding a result in which the placeholders are replaced by the corresponding values. ● In simple words, it’s an alternative to concatenation in a simpler way without using quoting and unquoting.
  • 15. 15 Dataweave : ndjson ● ndjson : Newline Delimited JSON format. ● Usage : Most log formats like elastic search queries uses the ndjson formats. ● Dataweave helps in the transformations with ndjson ● ndjson reader ignores all lines of ndjson data that are invalid if skipInvalid=true ● MIME TYPE : application/x-ndjson ● Each line of ndjson is mapped to one object in the array Example ndjson: {"name": “David","lastName": “Ross"} {"name": "Mariano","lastName": “Dekker"}
  • 16. 16 Dataweave : ndjson ● Sample scenario of using ndjson: To bulk update the records in an elastic index we use the ndjson format with the below query: Sample input JSON: [{"id": "12345","empName": "David", "department" : "finance", "role": "TL"}, {"id": "123456","empName": "Kiran", "department": "payroll", "role": “TL"} ] POST my_elastic_index/_bulk {"update": {"_id": " 12345 "}} {"doc": {"empName": " David","department": "finance","role": "TL"},"doc_as_upsert": true} {"update": {"_id": "00010783625"}} {"doc": {"empName": "Kiran","department": "payroll","role": “TL"},"doc_as_upsert":
  • 17. 17 Dataweave : Match case ● Instead of using multiple if and else condition we can use a match case to determine the respective output. ● It behaves just as the switch statement in another languages. Syntax: inputExpression match { case <condition> -> <routing expression> case <condition> -> <routing expression> else -> <default routing expression> }
  • 19. 19 Dataweave : Recursion with Match case ● A recursive function solves a particular problem by calling a copy of itself. ● It’s a technique of making a function call itself. ● Scenarios : a. We want to check for null values and recursively replace with “” b. Wherever the number exists in the input payload change to 5 digit number recursively c. Make all the first letters of the entire payload values to capital Letters using recursion d. Map to Key recursively
  • 20. 20 Dataweave : Creating reusable functions ● A reusable code is the best standards of any programming language. ● If a function can be reused at multiple places, defining it as common function and calling at various flows makes the life easier. ● For example , let’s see the conversion of string to decimals and try to make it as a reusable function. “1234.567” as Number as String {format: “0.00”} -> “1234.56” If in another mapper we want the same function but with 3 decimal digits and in another with 4 digits and so on…
  • 21. 21 Dataweave : firstWith ● firstWith returns the first element that satisfies the condition. ● This is similar to filter condition, but it stops at the first element that satisfies the condition. ● Performance of firstWith may vary with filter.
  • 22. 22 Dataweave : cumulative Additions using Reduce ● Let us see how to add cumulatively the number of quantities using the reduce function.
  • 25. Enter Your Full Valid Name (no nick Names are allowed) Only those who have registered and joined the session will be allowed! 1. Go to Browser Enter : quizizz.com/join 2. Wait for code 3. Enter your name