SlideShare a Scribd company logo
1 of 20
Download to read offline
Senior Lead - Solutions Engineer, WSO2
File Processing and Websockets with
Ballerina
Chanaka Fernando
File Processing with Ballerina
• File-based data transfers are here to stay
• Cloud and on premise
• Extract, Transform, Load (ETL) requirements
• Different file formats
• Streaming large files
• Securely transfer files
File based data sharing
• File I/O as part of the Ballerina I/O
• Fine grained file access (Bytes, Characters)
• Coarse grained file access (Records)
• Large file transfer through streaming
• Connect with remote file systems (FTP,
SFTP, SMB, etc..)
File Processing with Ballerina
• Open
• List
• Create directory
• Copy
• Move
• Create new file
• Delete
Ballerina File API - Operations
function main (string[] args) {
file:File target = {path:"/tmp/result.txt"};
target.open(file:W);
boolean b = target.exists();
println("file exists: " + b);
file:File source = {path:"/tmp/result.txt"};
file:File destination = {path:"/tmp/copy.txt"};
file:copy(source, destination);
println("file copied: /tmp/result.txt to /tmp/copy.txt");
destination.delete();
println("file deleted: /tmp/copy.txt");
destination = {path:"/tmp/move.txt"};
file:move(source, destination);
}
Ballerina File API - Example
Open
Exists
Copy
Delete
Move
Ballerina I/O API
I/O APIs
Record I/O
RecordsCharacters
Bytes
I/O Channels: Files, Sockets, Devices, ….
BytesI/O
CharactersI/O
Console
I/O
DataI/O
Different record formats
• Read byte by byte
• Character by character
• Record by record
• Canonical byte representation
• Console I/O, Data I/O (Future)
Ballerina I/O API - Files
Read Characters From File
Read a Record From File
• Support connecting with remote file systems
over FTP/SMB/SFTP (in-development)
• Secure file transfer through encryption
Future Improvements
Websockets with Ballerina
• Modern applications (especially web)
consumes large amount of data in real time
• Request-Response pattern no longer
sufficient
• HTTP (1.1 and prior) lives with hacks (AJAX
long polling, Streaming, etc.)
Why Websockets?
• Long-lived connections
• Bi-directional messaging (full-duplex)
• Low usage of headers (save bandwidth)
• Co-exists with HTTP
With Websockets
• Support for different frame types (text, binary,
ping, pong)
• Sub protocol support
• SSL support
• Live alongside HTTP
Websockets in Ballerina
• Expose ballerina service through websockets
• Executes different logic based on message
type (text, binary, ping, pong)
• Can configure base path and port which is
exposing
Websockets Server connector
Websockets Server Connector
Websockets service definition
Client initiates a connection
Client connected
Text frame received
Connection closed
Service configuration
Websockets Client Connector
• Creates a connection with a websocket service
• Supports sub protocols
• Text, Binary, Ping, Pong message types
• Supports security
• Visit Ballerina website
https://ballerinalang.org/
• Start with examples
https://ballerinalang.org/docs/by-example/
• Contribute
https://github.com/ballerinalang
Download and getting started
19
wso2.com

More Related Content

What's hot

Linux Hosting Training Course [Level 1] - Lec 7
Linux Hosting Training Course [Level 1] - Lec 7Linux Hosting Training Course [Level 1] - Lec 7
Linux Hosting Training Course [Level 1] - Lec 7Ramy Allam
 
10 domino integration
10   domino integration10   domino integration
10 domino integrationdarwinodb
 
Mike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 NetworkingMike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 Networkingukdpe
 
Office Track: Exchange 2013 in the real world - Michael Van Horenbeeck
Office Track: Exchange 2013 in the real world - Michael Van HorenbeeckOffice Track: Exchange 2013 in the real world - Michael Van Horenbeeck
Office Track: Exchange 2013 in the real world - Michael Van HorenbeeckITProceed
 

What's hot (8)

Linux Hosting Training Course [Level 1] - Lec 7
Linux Hosting Training Course [Level 1] - Lec 7Linux Hosting Training Course [Level 1] - Lec 7
Linux Hosting Training Course [Level 1] - Lec 7
 
Inet prog
Inet progInet prog
Inet prog
 
10 domino integration
10   domino integration10   domino integration
10 domino integration
 
Web
WebWeb
Web
 
Mike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 NetworkingMike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 Networking
 
Office Track: Exchange 2013 in the real world - Michael Van Horenbeeck
Office Track: Exchange 2013 in the real world - Michael Van HorenbeeckOffice Track: Exchange 2013 in the real world - Michael Van Horenbeeck
Office Track: Exchange 2013 in the real world - Michael Van Horenbeeck
 
FTP
FTPFTP
FTP
 
slidesharenew1
slidesharenew1slidesharenew1
slidesharenew1
 

Similar to File processing and websockets with ballerina chanaka edited

Javase7 1641812
Javase7 1641812Javase7 1641812
Javase7 1641812Vinay H G
 
File connector
File connectorFile connector
File connectorkrishashi
 
Documenting metadata application profiles and vocabularies
Documenting metadata application profiles and vocabulariesDocumenting metadata application profiles and vocabularies
Documenting metadata application profiles and vocabulariesPaul Walk
 
transfer4all – send big files fluidly
transfer4all –  send big files fluidly transfer4all –  send big files fluidly
transfer4all – send big files fluidly transfer4all ltd
 
BITM3730Week10.pptx
BITM3730Week10.pptxBITM3730Week10.pptx
BITM3730Week10.pptxMattMarino13
 
C:\fakepath\run 20 exchange 2010
C:\fakepath\run 20 exchange 2010C:\fakepath\run 20 exchange 2010
C:\fakepath\run 20 exchange 2010guest3559b8d
 
Run 20 exchange 2010
Run 20 exchange 2010Run 20 exchange 2010
Run 20 exchange 2010guest3559b8d
 
C:\fakepath\run 20 exchange 2010
C:\fakepath\run 20 exchange 2010C:\fakepath\run 20 exchange 2010
C:\fakepath\run 20 exchange 2010guest3559b8d
 
File tranfer protocol
File tranfer protocolFile tranfer protocol
File tranfer protocolKunalThorat9
 
File transfer protocol
File transfer protocolFile transfer protocol
File transfer protocolAmandeep Kaur
 
Distributed File Systems
Distributed File SystemsDistributed File Systems
Distributed File Systemsawesomesos
 
Apache Tika end-to-end
Apache Tika end-to-endApache Tika end-to-end
Apache Tika end-to-endgagravarr
 
Introducing FileCatalyst Workflow
Introducing FileCatalyst WorkflowIntroducing FileCatalyst Workflow
Introducing FileCatalyst WorkflowFileCatalyst
 
Sochi games wrap-up
Sochi games wrap-upSochi games wrap-up
Sochi games wrap-upFileCatalyst
 
Linux Servers.pptx
Linux Servers.pptxLinux Servers.pptx
Linux Servers.pptxChSheraz3
 
A SharePoint File Migration Framework
A SharePoint File Migration FrameworkA SharePoint File Migration Framework
A SharePoint File Migration FrameworkGerry Brimacombe
 
IIS internet information service NSA.ppt
IIS internet information service NSA.pptIIS internet information service NSA.ppt
IIS internet information service NSA.pptImranAhmadAhmad
 
Pithos - Architecture and .NET Technologies
Pithos - Architecture and .NET TechnologiesPithos - Architecture and .NET Technologies
Pithos - Architecture and .NET TechnologiesPanagiotis Kanavos
 

Similar to File processing and websockets with ballerina chanaka edited (20)

Javase7 1641812
Javase7 1641812Javase7 1641812
Javase7 1641812
 
File connector
File connectorFile connector
File connector
 
Documenting metadata application profiles and vocabularies
Documenting metadata application profiles and vocabulariesDocumenting metadata application profiles and vocabularies
Documenting metadata application profiles and vocabularies
 
transfer4all – send big files fluidly
transfer4all –  send big files fluidly transfer4all –  send big files fluidly
transfer4all – send big files fluidly
 
BITM3730Week10.pptx
BITM3730Week10.pptxBITM3730Week10.pptx
BITM3730Week10.pptx
 
C:\fakepath\run 20 exchange 2010
C:\fakepath\run 20 exchange 2010C:\fakepath\run 20 exchange 2010
C:\fakepath\run 20 exchange 2010
 
Run 20 exchange 2010
Run 20 exchange 2010Run 20 exchange 2010
Run 20 exchange 2010
 
C:\fakepath\run 20 exchange 2010
C:\fakepath\run 20 exchange 2010C:\fakepath\run 20 exchange 2010
C:\fakepath\run 20 exchange 2010
 
File tranfer protocol
File tranfer protocolFile tranfer protocol
File tranfer protocol
 
File transfer protocol
File transfer protocolFile transfer protocol
File transfer protocol
 
Inexpensive storage
Inexpensive storageInexpensive storage
Inexpensive storage
 
Distributed File Systems
Distributed File SystemsDistributed File Systems
Distributed File Systems
 
Apache Tika end-to-end
Apache Tika end-to-endApache Tika end-to-end
Apache Tika end-to-end
 
Introducing FileCatalyst Workflow
Introducing FileCatalyst WorkflowIntroducing FileCatalyst Workflow
Introducing FileCatalyst Workflow
 
Os6
Os6Os6
Os6
 
Sochi games wrap-up
Sochi games wrap-upSochi games wrap-up
Sochi games wrap-up
 
Linux Servers.pptx
Linux Servers.pptxLinux Servers.pptx
Linux Servers.pptx
 
A SharePoint File Migration Framework
A SharePoint File Migration FrameworkA SharePoint File Migration Framework
A SharePoint File Migration Framework
 
IIS internet information service NSA.ppt
IIS internet information service NSA.pptIIS internet information service NSA.ppt
IIS internet information service NSA.ppt
 
Pithos - Architecture and .NET Technologies
Pithos - Architecture and .NET TechnologiesPithos - Architecture and .NET Technologies
Pithos - Architecture and .NET Technologies
 

More from Chanaka Fernando

Designing microservices platforms with nats
Designing microservices platforms with natsDesigning microservices platforms with nats
Designing microservices platforms with natsChanaka Fernando
 
WSO2 API microgateway introduction
WSO2 API microgateway introductionWSO2 API microgateway introduction
WSO2 API microgateway introductionChanaka Fernando
 
Wso2 api microgateway deployment patterns
Wso2 api microgateway deployment patternsWso2 api microgateway deployment patterns
Wso2 api microgateway deployment patternsChanaka Fernando
 
Federated api management with wso2 api manager
Federated api management with wso2 api managerFederated api management with wso2 api manager
Federated api management with wso2 api managerChanaka Fernando
 
Wso2 enterprise integrator deployment patterns
Wso2 enterprise integrator deployment patternsWso2 enterprise integrator deployment patterns
Wso2 enterprise integrator deployment patternsChanaka Fernando
 
Api management best practices with wso2 api manager
Api management best practices with wso2 api managerApi management best practices with wso2 api manager
Api management best practices with wso2 api managerChanaka Fernando
 
Wso2 api manager analytics and reporting
Wso2 api manager analytics and reportingWso2 api manager analytics and reporting
Wso2 api manager analytics and reportingChanaka Fernando
 
Exploring ballerina toolset (docker, testing, tracing, analytics, and more) ...
Exploring ballerina toolset (docker, testing, tracing, analytics, and more)  ...Exploring ballerina toolset (docker, testing, tracing, analytics, and more)  ...
Exploring ballerina toolset (docker, testing, tracing, analytics, and more) ...Chanaka Fernando
 
Hybrid integration platform reference architecture
Hybrid integration platform reference architectureHybrid integration platform reference architecture
Hybrid integration platform reference architectureChanaka Fernando
 
Wso2 integration platform deep dive eu con 2016
Wso2 integration platform deep dive   eu con 2016Wso2 integration platform deep dive   eu con 2016
Wso2 integration platform deep dive eu con 2016Chanaka Fernando
 
Wso2 esb-maintenance-guide
Wso2 esb-maintenance-guideWso2 esb-maintenance-guide
Wso2 esb-maintenance-guideChanaka Fernando
 
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...Chanaka Fernando
 
Wso2 esb 5.0.0 product release webinar
Wso2 esb 5.0.0   product release webinarWso2 esb 5.0.0   product release webinar
Wso2 esb 5.0.0 product release webinarChanaka Fernando
 
Introduction to WSO2 ESB Pass-Through Transport
Introduction to WSO2 ESB Pass-Through TransportIntroduction to WSO2 ESB Pass-Through Transport
Introduction to WSO2 ESB Pass-Through TransportChanaka Fernando
 

More from Chanaka Fernando (17)

Designing microservices platforms with nats
Designing microservices platforms with natsDesigning microservices platforms with nats
Designing microservices platforms with nats
 
WSO2 API microgateway introduction
WSO2 API microgateway introductionWSO2 API microgateway introduction
WSO2 API microgateway introduction
 
Wso2 api microgateway deployment patterns
Wso2 api microgateway deployment patternsWso2 api microgateway deployment patterns
Wso2 api microgateway deployment patterns
 
Federated api management with wso2 api manager
Federated api management with wso2 api managerFederated api management with wso2 api manager
Federated api management with wso2 api manager
 
Wso2 enterprise integrator deployment patterns
Wso2 enterprise integrator deployment patternsWso2 enterprise integrator deployment patterns
Wso2 enterprise integrator deployment patterns
 
Api management best practices with wso2 api manager
Api management best practices with wso2 api managerApi management best practices with wso2 api manager
Api management best practices with wso2 api manager
 
Wso2 api manager analytics and reporting
Wso2 api manager analytics and reportingWso2 api manager analytics and reporting
Wso2 api manager analytics and reporting
 
Exploring ballerina toolset (docker, testing, tracing, analytics, and more) ...
Exploring ballerina toolset (docker, testing, tracing, analytics, and more)  ...Exploring ballerina toolset (docker, testing, tracing, analytics, and more)  ...
Exploring ballerina toolset (docker, testing, tracing, analytics, and more) ...
 
Hybrid integration platform reference architecture
Hybrid integration platform reference architectureHybrid integration platform reference architecture
Hybrid integration platform reference architecture
 
Wso2 esb-rest-integration
Wso2 esb-rest-integrationWso2 esb-rest-integration
Wso2 esb-rest-integration
 
Wso2 integration platform deep dive eu con 2016
Wso2 integration platform deep dive   eu con 2016Wso2 integration platform deep dive   eu con 2016
Wso2 integration platform deep dive eu con 2016
 
Wso2 esb-maintenance-guide
Wso2 esb-maintenance-guideWso2 esb-maintenance-guide
Wso2 esb-maintenance-guide
 
Advaced training-wso2-esb
Advaced training-wso2-esbAdvaced training-wso2-esb
Advaced training-wso2-esb
 
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...Wso2 con eu 2016   an introduction to the wso2 integration platform by chanak...
Wso2 con eu 2016 an introduction to the wso2 integration platform by chanak...
 
Esb 4.9.0 release webinar
Esb 4.9.0 release webinarEsb 4.9.0 release webinar
Esb 4.9.0 release webinar
 
Wso2 esb 5.0.0 product release webinar
Wso2 esb 5.0.0   product release webinarWso2 esb 5.0.0   product release webinar
Wso2 esb 5.0.0 product release webinar
 
Introduction to WSO2 ESB Pass-Through Transport
Introduction to WSO2 ESB Pass-Through TransportIntroduction to WSO2 ESB Pass-Through Transport
Introduction to WSO2 ESB Pass-Through Transport
 

Recently uploaded

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

File processing and websockets with ballerina chanaka edited

  • 1. Senior Lead - Solutions Engineer, WSO2 File Processing and Websockets with Ballerina Chanaka Fernando
  • 3. • File-based data transfers are here to stay • Cloud and on premise • Extract, Transform, Load (ETL) requirements • Different file formats • Streaming large files • Securely transfer files File based data sharing
  • 4. • File I/O as part of the Ballerina I/O • Fine grained file access (Bytes, Characters) • Coarse grained file access (Records) • Large file transfer through streaming • Connect with remote file systems (FTP, SFTP, SMB, etc..) File Processing with Ballerina
  • 5. • Open • List • Create directory • Copy • Move • Create new file • Delete Ballerina File API - Operations
  • 6. function main (string[] args) { file:File target = {path:"/tmp/result.txt"}; target.open(file:W); boolean b = target.exists(); println("file exists: " + b); file:File source = {path:"/tmp/result.txt"}; file:File destination = {path:"/tmp/copy.txt"}; file:copy(source, destination); println("file copied: /tmp/result.txt to /tmp/copy.txt"); destination.delete(); println("file deleted: /tmp/copy.txt"); destination = {path:"/tmp/move.txt"}; file:move(source, destination); } Ballerina File API - Example Open Exists Copy Delete Move
  • 7. Ballerina I/O API I/O APIs Record I/O RecordsCharacters Bytes I/O Channels: Files, Sockets, Devices, …. BytesI/O CharactersI/O Console I/O DataI/O Different record formats
  • 8. • Read byte by byte • Character by character • Record by record • Canonical byte representation • Console I/O, Data I/O (Future) Ballerina I/O API - Files
  • 10. Read a Record From File
  • 11. • Support connecting with remote file systems over FTP/SMB/SFTP (in-development) • Secure file transfer through encryption Future Improvements
  • 13. • Modern applications (especially web) consumes large amount of data in real time • Request-Response pattern no longer sufficient • HTTP (1.1 and prior) lives with hacks (AJAX long polling, Streaming, etc.) Why Websockets?
  • 14. • Long-lived connections • Bi-directional messaging (full-duplex) • Low usage of headers (save bandwidth) • Co-exists with HTTP With Websockets
  • 15. • Support for different frame types (text, binary, ping, pong) • Sub protocol support • SSL support • Live alongside HTTP Websockets in Ballerina
  • 16. • Expose ballerina service through websockets • Executes different logic based on message type (text, binary, ping, pong) • Can configure base path and port which is exposing Websockets Server connector
  • 17. Websockets Server Connector Websockets service definition Client initiates a connection Client connected Text frame received Connection closed Service configuration
  • 18. Websockets Client Connector • Creates a connection with a websocket service • Supports sub protocols • Text, Binary, Ping, Pong message types • Supports security
  • 19. • Visit Ballerina website https://ballerinalang.org/ • Start with examples https://ballerinalang.org/docs/by-example/ • Contribute https://github.com/ballerinalang Download and getting started 19