SlideShare a Scribd company logo
1 of 19
Download to read offline
REACTIVE WITH PLAY AND AKKA 
Markus Jura
ABOUT ME 
Consultant 
@Typesafe 
Living in Hamburg 
Co-Founder of 
testmunk 
3 years Scala, 10 years Java background 
Follow @markusjura Follow @markusjura 233 followers
REACTIVE APPS 
reactivemanifesto.org
Productivity 
Scalable 
Modern web & mobile
ROUTES 
VERB PATH CONTROLLER_METHOD 
GET / controllers.Application.index() 
GET /foo controllers.Application.foo() 
Declarative, type-safe URL Mapping
CONTROLLERS 
public static Result index() { 
return ok("Hello World!"); 
}
ASYNCHRONOUS REQUEST 
import play.libs.F.*; 
private static Integer calc() { 
return (5134 * 5789) / 349; 
} 
public static Promise<Result> basicPromise() { 
Promise<Integer> promise = Promise.promise(() -> calc()); 
return promise.map(i -> ok("Result is: " + i)); 
}
HTTP REQUEST 
public static Promise<Result> getPage() { 
final Promise<WSResponse> promise = 
WS.url("http://google.com").get(); 
return promise.map(response -> ok(response.getBody())); 
}
CONCURRENT HTTP REQUESTS 
public static Promise<Result> composition() { 
final Promise<WSResponse> googlePromise = 
WS.url("http://google.com").get(); 
final Promise<WSResponse> twitterPromise = 
WS.url("http://twitter.com").get(); 
return googlePromise.flatMap(google -> 
twitterPromise.map(twitter -> 
ok(google.getBody() + twitter.getBody()))); 
}
WEBSOCKETS OVERVIEW
WEBSOCKETS CLIENT CODE 
ws = new WebSocket("ws://url/echo") 
ws.onmessage = (event) -> 
alert(event.data) 
ws.onopen = () -> 
ws.send("Echo") 
CoffeeScript
WEBSOCKETS SERVER CODE 
public static WebSocket<JsonNode> echo() { 
return WebSocket.whenReady((in, out) -> { 
in.onMessage(out::write); 
in.onClose(() -> Logger.debug("Connection closed")); 
}); 
} 
Play Controller
Single unified programming model for 
Simpler concurrency 
Simpler distribution 
Simpler fault tolerance
SIMPLER CONCURRENCY 
Actors let us write code in a single-threaded illusion 
No locks, synchronized or other primitives needed
SIMPLER DISTRIBUTION 
Everything in Akka is distributed by default 
Akka goes from remote to local by optimization
SIMPLER FAULT TOLERANCE 
Akka decouples communication from failure handling: 
Supervisors handle failure 
Callers need not care (they can't anyway)
REACTIVE STOCKS ARCHITECTURE
Demo
THANK YOU 
Slide Deck on 
Reactive Stocks 
Github 
Activator Template 
Follow @markusjura Follow @markusjura 233 followers

More Related Content

What's hot

SockJS Intro
SockJS IntroSockJS Intro
SockJS Intro
Ngoc Dao
 

What's hot (20)

Going real time with Socket.io
Going real time with Socket.ioGoing real time with Socket.io
Going real time with Socket.io
 
Ssh to Bluemix runtime container
Ssh to Bluemix runtime containerSsh to Bluemix runtime container
Ssh to Bluemix runtime container
 
Windows Azure - Automating app lifecycle
Windows Azure - Automating app lifecycleWindows Azure - Automating app lifecycle
Windows Azure - Automating app lifecycle
 
Socket.io (part 1)
Socket.io (part 1)Socket.io (part 1)
Socket.io (part 1)
 
Volt ruby framework
Volt ruby frameworkVolt ruby framework
Volt ruby framework
 
How to deploy and scale your meteor apps
How to deploy and scale your meteor appsHow to deploy and scale your meteor apps
How to deploy and scale your meteor apps
 
One vagrantfile to rule them all
One vagrantfile to rule them allOne vagrantfile to rule them all
One vagrantfile to rule them all
 
Ansible 2.2
Ansible 2.2Ansible 2.2
Ansible 2.2
 
Webinar: Automate IBM Connections Installations and more
Webinar: Automate IBM Connections Installations and moreWebinar: Automate IBM Connections Installations and more
Webinar: Automate IBM Connections Installations and more
 
SockJS Intro
SockJS IntroSockJS Intro
SockJS Intro
 
Push the web with HTML5
Push the web with HTML5Push the web with HTML5
Push the web with HTML5
 
rioinfo2012
rioinfo2012rioinfo2012
rioinfo2012
 
Getting started with docker
Getting started with dockerGetting started with docker
Getting started with docker
 
Hadoop presentation
Hadoop presentationHadoop presentation
Hadoop presentation
 
Windows Azure - Cloud Service Development Best Practices
Windows Azure - Cloud Service Development Best PracticesWindows Azure - Cloud Service Development Best Practices
Windows Azure - Cloud Service Development Best Practices
 
Socket.IO
Socket.IOSocket.IO
Socket.IO
 
Node worshop Realtime - Socket.io
Node worshop Realtime - Socket.ioNode worshop Realtime - Socket.io
Node worshop Realtime - Socket.io
 
Elastic stack
Elastic stackElastic stack
Elastic stack
 
COSTRUIRE INTERFACCE WEB UTILIZZANDO REACTJS (Gabriele Petronella)
COSTRUIRE INTERFACCE WEB UTILIZZANDO REACTJS (Gabriele Petronella)COSTRUIRE INTERFACCE WEB UTILIZZANDO REACTJS (Gabriele Petronella)
COSTRUIRE INTERFACCE WEB UTILIZZANDO REACTJS (Gabriele Petronella)
 
Deploy a compute instance with a remote startup script
Deploy a compute instance with a remote startup scriptDeploy a compute instance with a remote startup script
Deploy a compute instance with a remote startup script
 

Viewers also liked

Akka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with ScalaAkka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with Scala
Jerry Kuru
 
Akka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsAkka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based Applications
NLJUG
 
Scala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuScala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on Heroku
Havoc Pennington
 

Viewers also liked (13)

Akka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with ScalaAkka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with Scala
 
Reactive microservices with play and akka
Reactive microservices with play and akkaReactive microservices with play and akka
Reactive microservices with play and akka
 
Practical Akka HTTP - introduction
Practical Akka HTTP - introductionPractical Akka HTTP - introduction
Practical Akka HTTP - introduction
 
Akka: Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through Ac...
Akka: Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through Ac...Akka: Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through Ac...
Akka: Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through Ac...
 
The Play Framework at LinkedIn
The Play Framework at LinkedInThe Play Framework at LinkedIn
The Play Framework at LinkedIn
 
Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTP
 
Why Play Framework is fast
Why Play Framework is fastWhy Play Framework is fast
Why Play Framework is fast
 
Akka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsAkka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based Applications
 
Without Resilience, Nothing Else Matters
Without Resilience, Nothing Else MattersWithout Resilience, Nothing Else Matters
Without Resilience, Nothing Else Matters
 
Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
Node.js vs Play Framework
Node.js vs Play FrameworkNode.js vs Play Framework
Node.js vs Play Framework
 
Scala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuScala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on Heroku
 

Similar to Introduction to Reactive with Play and Akka - Markus Jura

Similar to Introduction to Reactive with Play and Akka - Markus Jura (20)

10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
 
Non Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJavaNon Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJava
 
iOS build that scales
iOS build that scalesiOS build that scales
iOS build that scales
 
FrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftFrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) Swift
 
Lecture 10 Networking on Mobile Devices
Lecture 10 Networking on Mobile DevicesLecture 10 Networking on Mobile Devices
Lecture 10 Networking on Mobile Devices
 
Android Networking
Android NetworkingAndroid Networking
Android Networking
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
 
Infinum Android Talks #17 - A quest for WebSockets by Zeljko Plesac
Infinum Android Talks #17 - A quest for WebSockets by Zeljko PlesacInfinum Android Talks #17 - A quest for WebSockets by Zeljko Plesac
Infinum Android Talks #17 - A quest for WebSockets by Zeljko Plesac
 
WebRTC + Socket.io: building a skype-like video chat with native javascript
WebRTC + Socket.io: building a skype-like video chat with native javascriptWebRTC + Socket.io: building a skype-like video chat with native javascript
WebRTC + Socket.io: building a skype-like video chat with native javascript
 
當ZK遇見Front-End
當ZK遇見Front-End當ZK遇見Front-End
當ZK遇見Front-End
 
Angular and The Case for RxJS
Angular and The Case for RxJSAngular and The Case for RxJS
Angular and The Case for RxJS
 
Introduction to Vert.x
Introduction to Vert.xIntroduction to Vert.x
Introduction to Vert.x
 
A Blueprint for Scala Microservices
A Blueprint for Scala MicroservicesA Blueprint for Scala Microservices
A Blueprint for Scala Microservices
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSockets
 
KSDG-iSlide App 開發心得分享
KSDG-iSlide App 開發心得分享KSDG-iSlide App 開發心得分享
KSDG-iSlide App 開發心得分享
 
Microservice Come in Systems
Microservice Come in SystemsMicroservice Come in Systems
Microservice Come in Systems
 
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop LabsJCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 

More from NLJUG

Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
NLJUG
 

More from NLJUG (20)

The future of Web-Scale - Johan Tillema, Rene Boere & Chris Quach
The future of Web-Scale - Johan Tillema, Rene Boere & Chris QuachThe future of Web-Scale - Johan Tillema, Rene Boere & Chris Quach
The future of Web-Scale - Johan Tillema, Rene Boere & Chris Quach
 
Speedy perception trumps speedy reception–smart asynchronous interactions - L...
Speedy perception trumps speedy reception–smart asynchronous interactions - L...Speedy perception trumps speedy reception–smart asynchronous interactions - L...
Speedy perception trumps speedy reception–smart asynchronous interactions - L...
 
Decoding the airspace above you with Java and $7 hardware - Bert Jan Schrijver
Decoding the airspace above you with Java and $7 hardware - Bert Jan SchrijverDecoding the airspace above you with Java and $7 hardware - Bert Jan Schrijver
Decoding the airspace above you with Java and $7 hardware - Bert Jan Schrijver
 
Using Docker to Develop, Test and Run Maven Projects - Wouter Danes
Using Docker to Develop, Test and Run Maven Projects - Wouter DanesUsing Docker to Develop, Test and Run Maven Projects - Wouter Danes
Using Docker to Develop, Test and Run Maven Projects - Wouter Danes
 
Kill the mutants and test your tests - Roy van Rijn
Kill the mutants and test your tests - Roy van RijnKill the mutants and test your tests - Roy van Rijn
Kill the mutants and test your tests - Roy van Rijn
 
Real-time user interfaces - sosm gewoon makkelijker - Allard Buijze
Real-time user interfaces - sosm gewoon makkelijker - Allard BuijzeReal-time user interfaces - sosm gewoon makkelijker - Allard Buijze
Real-time user interfaces - sosm gewoon makkelijker - Allard Buijze
 
The end of traditional enterprise IT - ING's journey to the next generation I...
The end of traditional enterprise IT - ING's journey to the next generation I...The end of traditional enterprise IT - ING's journey to the next generation I...
The end of traditional enterprise IT - ING's journey to the next generation I...
 
Performance van Java 8 en verder - Jeroen Borgers
Performance van Java 8 en verder - Jeroen BorgersPerformance van Java 8 en verder - Jeroen Borgers
Performance van Java 8 en verder - Jeroen Borgers
 
Web-scale op basis van Hadoop en Akka Reactive Streams - Johan Tillema, Rene ...
Web-scale op basis van Hadoop en Akka Reactive Streams - Johan Tillema, Rene ...Web-scale op basis van Hadoop en Akka Reactive Streams - Johan Tillema, Rene ...
Web-scale op basis van Hadoop en Akka Reactive Streams - Johan Tillema, Rene ...
 
Workshop angular dart presentatie - Atos
Workshop angular dart presentatie - AtosWorkshop angular dart presentatie - Atos
Workshop angular dart presentatie - Atos
 
Workshop spring boot presentatie - Atos
Workshop spring boot presentatie - AtosWorkshop spring boot presentatie - Atos
Workshop spring boot presentatie - Atos
 
Cultivating the jenkins job jungle with groovy - Patrick van Dissel
Cultivating the jenkins job jungle with groovy - Patrick van DisselCultivating the jenkins job jungle with groovy - Patrick van Dissel
Cultivating the jenkins job jungle with groovy - Patrick van Dissel
 
Rethink your architecture - Marten Deinum
Rethink your architecture - Marten DeinumRethink your architecture - Marten Deinum
Rethink your architecture - Marten Deinum
 
Evolutionary Algorithms: the key to solving complex Java puzzles! - Bas knopper
Evolutionary Algorithms: the key to solving complex Java puzzles! - Bas knopperEvolutionary Algorithms: the key to solving complex Java puzzles! - Bas knopper
Evolutionary Algorithms: the key to solving complex Java puzzles! - Bas knopper
 
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
 
Apache Wicket: 10 jaar en verder - Martijn Dashorst
Apache Wicket: 10 jaar en verder - Martijn DashorstApache Wicket: 10 jaar en verder - Martijn Dashorst
Apache Wicket: 10 jaar en verder - Martijn Dashorst
 
Opening - Bert Ertman
Opening - Bert ErtmanOpening - Bert Ertman
Opening - Bert Ertman
 
Returning the right results - Jettro Coenradie
Returning the right results - Jettro CoenradieReturning the right results - Jettro Coenradie
Returning the right results - Jettro Coenradie
 
Reactive programming met Java 8 en Java EE 7 - Martijn Blankestijn
Reactive programming met Java 8 en Java EE 7 - Martijn BlankestijnReactive programming met Java 8 en Java EE 7 - Martijn Blankestijn
Reactive programming met Java 8 en Java EE 7 - Martijn Blankestijn
 
Event-sourced architectures with Akka - Sander Mak
Event-sourced architectures with Akka - Sander MakEvent-sourced architectures with Akka - Sander Mak
Event-sourced architectures with Akka - Sander Mak
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
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
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

Introduction to Reactive with Play and Akka - Markus Jura

  • 1. REACTIVE WITH PLAY AND AKKA Markus Jura
  • 2. ABOUT ME Consultant @Typesafe Living in Hamburg Co-Founder of testmunk 3 years Scala, 10 years Java background Follow @markusjura Follow @markusjura 233 followers
  • 5. ROUTES VERB PATH CONTROLLER_METHOD GET / controllers.Application.index() GET /foo controllers.Application.foo() Declarative, type-safe URL Mapping
  • 6. CONTROLLERS public static Result index() { return ok("Hello World!"); }
  • 7. ASYNCHRONOUS REQUEST import play.libs.F.*; private static Integer calc() { return (5134 * 5789) / 349; } public static Promise<Result> basicPromise() { Promise<Integer> promise = Promise.promise(() -> calc()); return promise.map(i -> ok("Result is: " + i)); }
  • 8. HTTP REQUEST public static Promise<Result> getPage() { final Promise<WSResponse> promise = WS.url("http://google.com").get(); return promise.map(response -> ok(response.getBody())); }
  • 9. CONCURRENT HTTP REQUESTS public static Promise<Result> composition() { final Promise<WSResponse> googlePromise = WS.url("http://google.com").get(); final Promise<WSResponse> twitterPromise = WS.url("http://twitter.com").get(); return googlePromise.flatMap(google -> twitterPromise.map(twitter -> ok(google.getBody() + twitter.getBody()))); }
  • 11. WEBSOCKETS CLIENT CODE ws = new WebSocket("ws://url/echo") ws.onmessage = (event) -> alert(event.data) ws.onopen = () -> ws.send("Echo") CoffeeScript
  • 12. WEBSOCKETS SERVER CODE public static WebSocket<JsonNode> echo() { return WebSocket.whenReady((in, out) -> { in.onMessage(out::write); in.onClose(() -> Logger.debug("Connection closed")); }); } Play Controller
  • 13. Single unified programming model for Simpler concurrency Simpler distribution Simpler fault tolerance
  • 14. SIMPLER CONCURRENCY Actors let us write code in a single-threaded illusion No locks, synchronized or other primitives needed
  • 15. SIMPLER DISTRIBUTION Everything in Akka is distributed by default Akka goes from remote to local by optimization
  • 16. SIMPLER FAULT TOLERANCE Akka decouples communication from failure handling: Supervisors handle failure Callers need not care (they can't anyway)
  • 18. Demo
  • 19. THANK YOU Slide Deck on Reactive Stocks Github Activator Template Follow @markusjura Follow @markusjura 233 followers