SlideShare a Scribd company logo
Introduction to Akka
(for Scala infants !!!!)
-------
Prasanna Kumar
Excuse me !!!!!
I assume that you ,,,,
already stepped in to "Scala"land and its a JVM
language
written some Scala code and understand its
fundementals
familiar with SBT (like maven)
About this talk
is
for "Impatient"
help you to write Akka Code "right now" in
Scala
distinguish Actor model and Akka
not
teaching the partial functions and algebraic
data types in Scala
cover all aspects of Akka
Agenda
What makes us to consider Actor Model
Understanding Actor model of programming
Introducing to Akka
Akka Actor model approach
Setting up
Writing Actors using Akka (with code examples)
Moving forward (touchbase)
Q&A
What makes us to consider Actor
Model
Modern day programming need to process lot of
data in terms of
- volume
- variety
- velocity
our code started to use multiple CPU cores within
the machine or across a cluster
What makes us to consider Actor
Model (contd)
Obvious option is to consider aysnc programming
with "threads"
(atleast in Java) programming for threads is a
cumbersome
requires a lot of boiler-plate code
communicaiton between threads (with in and
outside JVM) is tedious
What makes us to consider Actor
Model (contd)
does this means the thread model is broken ??
No .. but it serves as a good foundation
just that it need better async abstraction
So how do we solve this ?
for writing concurrent and distributed programs,
we need threads to communicate easily
"Actor Model" to the rescue
What is an Actor
this model prescribes an "Actor" backed by a
thread model (by the underlying runtime or OS)
Async abstraction can be expressed as an actor in
the form of Class or function
an Actor framework
can create & manage actor
clients can communicate only by passing messages
(Async'ly) to the actor
actors can also communicate between themselves
What is an Actor
unlike Thread, an Actor
message driven
responds to certain messages from other Actors
(or non-actors)
can handle only one message at any instant of
time
Actor model of programming (contd)
Introducing Akka
Scala/Java API whcih implements the Actor model
provides a framework to create & manage actors ,
backed by JVM Thread model
Akka provides a mailbox for each actor : in-
memory queue to stage messages
clients acan send messages either by
! send or ? ask pattern (more on that later)
actor reveives messages and respond to clients
Akka actors use pattern matching to hande
messages
Lets start coding
Setting up
sbt co-ordinates
in build.sbt
name := "hyscala-akka-intro-talk"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4.14")
open the project in your IDE to get started
plain simple actor
class PlainActor extends Actor {
def receive: Receive = {
case _ =>
}
}
actor which can respond to some messages:
class PrimitiveHandlingActor extends Actor {
def receive: Receive = {
case "hello world" => println("""received hello world """)
case 11 => println("received ")
case _ => println("some other data type")
}
}
simple shopping cart
cart and order as two actors
show case their interaction with simple messages
covers actor to actor message passing
Messages
case class Item(name: String, quantity: Int,
rate: Double)
case object Done
case class Order(item: List[Item])
Cart Actor
class CartActor extends Actor {
val items = ListBuffer[Item]()
def receive: Receive = {
case item: Item => items.+=(item)
// done with adding items to cart
case Done => ???
}
}
Cart Actor - next version
class CartActor(billingActor: ActorRef) extends Actor {
...
case Done =>
billingActor ! Order(items.toList)
items.clear()
}
Billing Actor
class BilingActor extends Actor {
def receive: Receive = {
case order: Order =>
println(s"Here your bill ${Bill(order.items.foldLeft(0.0)((a
}
}
all together ....
ouput:
Here your bill Bill(175.0)
object AkkaIntroTalk extends App {
val actorSystem = ActorSystem("actorsystem")
val billingActor = actorSystem.actorOf(Props[BillingActor],
val cartActor = actorSystem.actorOf(Props(classOf[CartAct
cartActor ! Item("Apple", 3, 20.0)
cartActor ! Item("Orange", 3, 15.0)
cartActor ! Item("Butter", 1, 70.0)
cartActor ! Done
}
Learning Akka
Online
Akka Docs
Let it crash - blog
Books
Learning Akka
Reactive Programming with Scala and Akka -
(I've authored this book)
Moving forward (touchbase)
Actor heirarchy
FSM
Load Balacing
Akka Clustering
Akka HTTP
Takeaway
https://github.com/prassee/hyscala-akka-intro-
talk/tree/master
Q&A
Akka introtalk HyScala DEC 2016

More Related Content

What's hot

Zend Studio Tips and Tricks
Zend Studio Tips and TricksZend Studio Tips and Tricks
Zend Studio Tips and Tricks
Roy Ganor
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
Heiko Behrens
 
Use the @types, Luke
Use the @types, LukeUse the @types, Luke
Use the @types, Luke
Brooklyn Zelenka
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
Priya Goyal
 
Books
BooksBooks
Javascript
JavascriptJavascript
Javascript
Aditya Gaur
 
C#/.NET Little Pitfalls
C#/.NET Little PitfallsC#/.NET Little Pitfalls
C#/.NET Little Pitfalls
BlackRabbitCoder
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
Walid Ashraf
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_script
Vijay Kalyan
 
Javascript
JavascriptJavascript
Javascript
Vibhor Grover
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Amit Tyagi
 
javascript
javascript javascript
javascript
Kaya Ota
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
Yakov Fain
 
Virtual function and abstract class
Virtual function and abstract classVirtual function and abstract class
Virtual function and abstract class
Shweta Shah
 
Variables in Pharo5
Variables in Pharo5Variables in Pharo5
Variables in Pharo5
Marcus Denker
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
Yakov Fain
 
IOS Swift language 2nd tutorial
IOS Swift language 2nd tutorialIOS Swift language 2nd tutorial
IOS Swift language 2nd tutorial
Hassan A-j
 
Javascript
JavascriptJavascript
Javascript
Nagarajan
 
Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
Hassan Ahmed Baig - Web Developer
 
Java script
Java scriptJava script
Java script
Abhishek Kesharwani
 

What's hot (20)

Zend Studio Tips and Tricks
Zend Studio Tips and TricksZend Studio Tips and Tricks
Zend Studio Tips and Tricks
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
Use the @types, Luke
Use the @types, LukeUse the @types, Luke
Use the @types, Luke
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Books
BooksBooks
Books
 
Javascript
JavascriptJavascript
Javascript
 
C#/.NET Little Pitfalls
C#/.NET Little PitfallsC#/.NET Little Pitfalls
C#/.NET Little Pitfalls
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_script
 
Javascript
JavascriptJavascript
Javascript
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
javascript
javascript javascript
javascript
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
 
Virtual function and abstract class
Virtual function and abstract classVirtual function and abstract class
Virtual function and abstract class
 
Variables in Pharo5
Variables in Pharo5Variables in Pharo5
Variables in Pharo5
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
IOS Swift language 2nd tutorial
IOS Swift language 2nd tutorialIOS Swift language 2nd tutorial
IOS Swift language 2nd tutorial
 
Javascript
JavascriptJavascript
Javascript
 
Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
 
Java script
Java scriptJava script
Java script
 

Viewers also liked

Deep Introduction to Akka
Deep Introduction to AkkaDeep Introduction to Akka
Deep Introduction to Akka
patriknw
 
Akka/Actor introduction
Akka/Actor introductionAkka/Actor introduction
Akka/Actor introduction
Yuki Katada
 
Introduction to Akka
Introduction to AkkaIntroduction to Akka
Introduction to Akka
Piotr Trzpil
 
An Introduction to Akka
An Introduction to AkkaAn Introduction to Akka
An Introduction to Akka
SoftwareMill
 
Introduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users GroupIntroduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users Group
Roy Russo
 
Akka Actor presentation
Akka Actor presentationAkka Actor presentation
Akka Actor presentation
Gene Chang
 
Introduction to Akka
Introduction to AkkaIntroduction to Akka
Introduction to Akka
Johan Andrén
 
An Introduction to Akka http
An Introduction to Akka httpAn Introduction to Akka http
An Introduction to Akka http
Knoldus Inc.
 
ITFT_Inter process communication
ITFT_Inter process communicationITFT_Inter process communication
ITFT_Inter process communication
Sneh Prabha
 
The Actor Model - Towards Better Concurrency
The Actor Model - Towards Better ConcurrencyThe Actor Model - Towards Better Concurrency
The Actor Model - Towards Better Concurrency
Dror Bereznitsky
 

Viewers also liked (10)

Deep Introduction to Akka
Deep Introduction to AkkaDeep Introduction to Akka
Deep Introduction to Akka
 
Akka/Actor introduction
Akka/Actor introductionAkka/Actor introduction
Akka/Actor introduction
 
Introduction to Akka
Introduction to AkkaIntroduction to Akka
Introduction to Akka
 
An Introduction to Akka
An Introduction to AkkaAn Introduction to Akka
An Introduction to Akka
 
Introduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users GroupIntroduction to Akka - Atlanta Java Users Group
Introduction to Akka - Atlanta Java Users Group
 
Akka Actor presentation
Akka Actor presentationAkka Actor presentation
Akka Actor presentation
 
Introduction to Akka
Introduction to AkkaIntroduction to Akka
Introduction to Akka
 
An Introduction to Akka http
An Introduction to Akka httpAn Introduction to Akka http
An Introduction to Akka http
 
ITFT_Inter process communication
ITFT_Inter process communicationITFT_Inter process communication
ITFT_Inter process communication
 
The Actor Model - Towards Better Concurrency
The Actor Model - Towards Better ConcurrencyThe Actor Model - Towards Better Concurrency
The Actor Model - Towards Better Concurrency
 

Similar to Akka introtalk HyScala DEC 2016

Scaling Web Apps with Akka
Scaling Web Apps with AkkaScaling Web Apps with Akka
Scaling Web Apps with Akka
Maciej Matyjas
 
Akka lsug skills matter
Akka lsug skills matterAkka lsug skills matter
Akka lsug skills matter
Skills Matter
 
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Konrad Malawski
 
Building Stateful Microservices With Akka
Building Stateful Microservices With AkkaBuilding Stateful Microservices With Akka
Building Stateful Microservices With Akka
Yaroslav Tkachenko
 
Anatomy of a Reactive Application
Anatomy of a Reactive ApplicationAnatomy of a Reactive Application
Anatomy of a Reactive Application
Mark Wilson
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_group
Skills Matter
 
A Survey of Concurrency Constructs
A Survey of Concurrency ConstructsA Survey of Concurrency Constructs
A Survey of Concurrency Constructs
Ted Leung
 
Akka Microservices Architecture And Design
Akka Microservices Architecture And DesignAkka Microservices Architecture And Design
Akka Microservices Architecture And Design
Yaroslav Tkachenko
 
Actor based approach in practice for Swift developers
Actor based approach in practice for Swift developersActor based approach in practice for Swift developers
Actor based approach in practice for Swift developers
Bartosz Polaczyk
 
Build Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and HerokuBuild Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and Heroku
Salesforce Developers
 
The Scala Programming Language
The Scala Programming LanguageThe Scala Programming Language
The Scala Programming Language
league
 
On Scala Slides - OSDC 2009
On Scala Slides - OSDC 2009On Scala Slides - OSDC 2009
On Scala Slides - OSDC 2009
Michael Neale
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJS
Alberto Paro
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.js
Scala Italy
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus Presentation
Ajax Experience 2009
 
Module design pattern i.e. express js
Module design pattern i.e. express jsModule design pattern i.e. express js
Module design pattern i.e. express js
Ahmed Assaf
 
Concurrency Constructs Overview
Concurrency Constructs OverviewConcurrency Constructs Overview
Concurrency Constructs Overview
stasimus
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
pramode_ce
 
Moderne backends mit dem aktor programmiermodell
Moderne backends mit dem aktor programmiermodellModerne backends mit dem aktor programmiermodell
Moderne backends mit dem aktor programmiermodell
Damir Dobric
 
Elasticsearch And Apache Lucene For Apache Spark And MLlib
Elasticsearch And Apache Lucene For Apache Spark And MLlibElasticsearch And Apache Lucene For Apache Spark And MLlib
Elasticsearch And Apache Lucene For Apache Spark And MLlib
Jen Aman
 

Similar to Akka introtalk HyScala DEC 2016 (20)

Scaling Web Apps with Akka
Scaling Web Apps with AkkaScaling Web Apps with Akka
Scaling Web Apps with Akka
 
Akka lsug skills matter
Akka lsug skills matterAkka lsug skills matter
Akka lsug skills matter
 
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
 
Building Stateful Microservices With Akka
Building Stateful Microservices With AkkaBuilding Stateful Microservices With Akka
Building Stateful Microservices With Akka
 
Anatomy of a Reactive Application
Anatomy of a Reactive ApplicationAnatomy of a Reactive Application
Anatomy of a Reactive Application
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_group
 
A Survey of Concurrency Constructs
A Survey of Concurrency ConstructsA Survey of Concurrency Constructs
A Survey of Concurrency Constructs
 
Akka Microservices Architecture And Design
Akka Microservices Architecture And DesignAkka Microservices Architecture And Design
Akka Microservices Architecture And Design
 
Actor based approach in practice for Swift developers
Actor based approach in practice for Swift developersActor based approach in practice for Swift developers
Actor based approach in practice for Swift developers
 
Build Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and HerokuBuild Cloud Applications with Akka and Heroku
Build Cloud Applications with Akka and Heroku
 
The Scala Programming Language
The Scala Programming LanguageThe Scala Programming Language
The Scala Programming Language
 
On Scala Slides - OSDC 2009
On Scala Slides - OSDC 2009On Scala Slides - OSDC 2009
On Scala Slides - OSDC 2009
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJS
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.js
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus Presentation
 
Module design pattern i.e. express js
Module design pattern i.e. express jsModule design pattern i.e. express js
Module design pattern i.e. express js
 
Concurrency Constructs Overview
Concurrency Constructs OverviewConcurrency Constructs Overview
Concurrency Constructs Overview
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
 
Moderne backends mit dem aktor programmiermodell
Moderne backends mit dem aktor programmiermodellModerne backends mit dem aktor programmiermodell
Moderne backends mit dem aktor programmiermodell
 
Elasticsearch And Apache Lucene For Apache Spark And MLlib
Elasticsearch And Apache Lucene For Apache Spark And MLlibElasticsearch And Apache Lucene For Apache Spark And MLlib
Elasticsearch And Apache Lucene For Apache Spark And MLlib
 

More from PrasannaKumar Sathyanarayanan

Akka fsm presentation
Akka fsm presentationAkka fsm presentation
Akka fsm presentation
PrasannaKumar Sathyanarayanan
 
Cps (continuation passing style) in scala
Cps (continuation passing style) in scalaCps (continuation passing style) in scala
Cps (continuation passing style) in scala
PrasannaKumar Sathyanarayanan
 
Introduction to akka chense
Introduction to akka   chenseIntroduction to akka   chense
Introduction to akka chense
PrasannaKumar Sathyanarayanan
 
Finagle - an intro to rpc & a sync programming in jvm
Finagle - an intro to rpc & a sync programming in jvmFinagle - an intro to rpc & a sync programming in jvm
Finagle - an intro to rpc & a sync programming in jvm
PrasannaKumar Sathyanarayanan
 
Websocket,JSON in JEE7
Websocket,JSON in JEE7Websocket,JSON in JEE7
Websocket,JSON in JEE7
PrasannaKumar Sathyanarayanan
 
Scala Introduction with play - for my CSS nerds
Scala Introduction with play - for my CSS nerdsScala Introduction with play - for my CSS nerds
Scala Introduction with play - for my CSS nerds
PrasannaKumar Sathyanarayanan
 
CDI in JEE6
CDI in JEE6CDI in JEE6
Ejb3.1
Ejb3.1Ejb3.1
Producer consumerproblem
Producer consumerproblemProducer consumerproblem
Producer consumerproblem
PrasannaKumar Sathyanarayanan
 
Scala presentationjune112011
Scala presentationjune112011Scala presentationjune112011
Scala presentationjune112011
PrasannaKumar Sathyanarayanan
 

More from PrasannaKumar Sathyanarayanan (10)

Akka fsm presentation
Akka fsm presentationAkka fsm presentation
Akka fsm presentation
 
Cps (continuation passing style) in scala
Cps (continuation passing style) in scalaCps (continuation passing style) in scala
Cps (continuation passing style) in scala
 
Introduction to akka chense
Introduction to akka   chenseIntroduction to akka   chense
Introduction to akka chense
 
Finagle - an intro to rpc & a sync programming in jvm
Finagle - an intro to rpc & a sync programming in jvmFinagle - an intro to rpc & a sync programming in jvm
Finagle - an intro to rpc & a sync programming in jvm
 
Websocket,JSON in JEE7
Websocket,JSON in JEE7Websocket,JSON in JEE7
Websocket,JSON in JEE7
 
Scala Introduction with play - for my CSS nerds
Scala Introduction with play - for my CSS nerdsScala Introduction with play - for my CSS nerds
Scala Introduction with play - for my CSS nerds
 
CDI in JEE6
CDI in JEE6CDI in JEE6
CDI in JEE6
 
Ejb3.1
Ejb3.1Ejb3.1
Ejb3.1
 
Producer consumerproblem
Producer consumerproblemProducer consumerproblem
Producer consumerproblem
 
Scala presentationjune112011
Scala presentationjune112011Scala presentationjune112011
Scala presentationjune112011
 

Recently uploaded

Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 

Recently uploaded (20)

Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 

Akka introtalk HyScala DEC 2016

  • 1. Introduction to Akka (for Scala infants !!!!) ------- Prasanna Kumar
  • 2. Excuse me !!!!! I assume that you ,,,, already stepped in to "Scala"land and its a JVM language written some Scala code and understand its fundementals familiar with SBT (like maven)
  • 3. About this talk is for "Impatient" help you to write Akka Code "right now" in Scala distinguish Actor model and Akka not teaching the partial functions and algebraic data types in Scala cover all aspects of Akka
  • 4. Agenda What makes us to consider Actor Model Understanding Actor model of programming Introducing to Akka Akka Actor model approach Setting up Writing Actors using Akka (with code examples) Moving forward (touchbase) Q&A
  • 5. What makes us to consider Actor Model Modern day programming need to process lot of data in terms of - volume - variety - velocity our code started to use multiple CPU cores within the machine or across a cluster
  • 6. What makes us to consider Actor Model (contd) Obvious option is to consider aysnc programming with "threads" (atleast in Java) programming for threads is a cumbersome requires a lot of boiler-plate code communicaiton between threads (with in and outside JVM) is tedious
  • 7. What makes us to consider Actor Model (contd) does this means the thread model is broken ?? No .. but it serves as a good foundation just that it need better async abstraction
  • 8. So how do we solve this ? for writing concurrent and distributed programs, we need threads to communicate easily "Actor Model" to the rescue
  • 9. What is an Actor this model prescribes an "Actor" backed by a thread model (by the underlying runtime or OS) Async abstraction can be expressed as an actor in the form of Class or function an Actor framework can create & manage actor clients can communicate only by passing messages (Async'ly) to the actor actors can also communicate between themselves
  • 10. What is an Actor unlike Thread, an Actor message driven responds to certain messages from other Actors (or non-actors) can handle only one message at any instant of time
  • 11. Actor model of programming (contd)
  • 12. Introducing Akka Scala/Java API whcih implements the Actor model provides a framework to create & manage actors , backed by JVM Thread model Akka provides a mailbox for each actor : in- memory queue to stage messages clients acan send messages either by ! send or ? ask pattern (more on that later) actor reveives messages and respond to clients Akka actors use pattern matching to hande messages
  • 14. Setting up sbt co-ordinates in build.sbt name := "hyscala-akka-intro-talk" version := "1.0" scalaVersion := "2.11.8" libraryDependencies ++= Seq( "com.typesafe.akka" %% "akka-actor" % "2.4.14") open the project in your IDE to get started
  • 15. plain simple actor class PlainActor extends Actor { def receive: Receive = { case _ => } } actor which can respond to some messages: class PrimitiveHandlingActor extends Actor { def receive: Receive = { case "hello world" => println("""received hello world """) case 11 => println("received ") case _ => println("some other data type") } }
  • 16. simple shopping cart cart and order as two actors show case their interaction with simple messages covers actor to actor message passing
  • 17. Messages case class Item(name: String, quantity: Int, rate: Double) case object Done case class Order(item: List[Item])
  • 18. Cart Actor class CartActor extends Actor { val items = ListBuffer[Item]() def receive: Receive = { case item: Item => items.+=(item) // done with adding items to cart case Done => ??? } }
  • 19. Cart Actor - next version class CartActor(billingActor: ActorRef) extends Actor { ... case Done => billingActor ! Order(items.toList) items.clear() }
  • 20. Billing Actor class BilingActor extends Actor { def receive: Receive = { case order: Order => println(s"Here your bill ${Bill(order.items.foldLeft(0.0)((a } }
  • 21. all together .... ouput: Here your bill Bill(175.0) object AkkaIntroTalk extends App { val actorSystem = ActorSystem("actorsystem") val billingActor = actorSystem.actorOf(Props[BillingActor], val cartActor = actorSystem.actorOf(Props(classOf[CartAct cartActor ! Item("Apple", 3, 20.0) cartActor ! Item("Orange", 3, 15.0) cartActor ! Item("Butter", 1, 70.0) cartActor ! Done }
  • 22. Learning Akka Online Akka Docs Let it crash - blog Books Learning Akka Reactive Programming with Scala and Akka - (I've authored this book)
  • 23. Moving forward (touchbase) Actor heirarchy FSM Load Balacing Akka Clustering Akka HTTP
  • 25. Q&A