SlideShare a Scribd company logo
1 of 18
Download to read offline
An Introduction to Akka
Mikołaj Koziarkiewicz
Akka - what is it? 1/2
a platform,
"for building highly concurrent, distributed, and resilient message-driven
applications on the JVM."[1],
based on the actor model.
Akka - what is it? 2/2
platform has a lot of specialized extensions
all based on the actor core
goal of the presentation:
explain the core
Actor model - what is it?
actor: unit of computation
actors build actor systems
quite "old" (1973).[2]
Anatomy of an Akka Actor - intro 1/2
class MyActor extends Actor {
def receive = {
case Something => //...
}
}
Anatomy of an Akka Actor - intro 2/2
My first Akka Actor™
class HaiActor extends Actor {
def receive: Receive = {
case target: ActorRef => target ! "Hello!"
case "Hello!" => sender ! "OHAI"
case "OHAI" => println(s"$self: got OHAI from
$sender")
}
}
Where:
type Receive = PartialFunction[Any, Unit]
My first Akka Actor™ - example
Anatomy of an Akka Actor - hierarchy
Akka actor model - lifecycle & hierarchy
Purpose:
division of labor
supervision:
each actor has lifecycle
special hooks - preStart, preRestart, postStop
allow for e.g. self-init
"parent" controls how it reacts to failure
Hierarchy - example
Akka - guarantees
an actor processes one message at a time,
a message will be delivered at most 1 times,
messages are ordered by sender
Guarantee takeaways
don’t pass mutable state,
use services to ensure send:
contex.scheduler
persistence
Testing
Akka Testkit
Features:
can run special 1-thread dispatcher
asserts for getting msgs
TestProbe
Remoting
Simple remoting:
e.g. "akka.tcp://remote@freund.de:1337
/user/actorName"
remote creation as well
Talking to actor system
Custom:
ask pattern
ask(actoRef, request)(timeout): Future
Many others (also builtin)
Summary
Akka - actor model on the JVM
alternative way to handle
concurrency
distribution
declared guarantees
make reasoning easier
THANK YOU!
The End
Doc link:
http://doc.akka.io/docs/akka/current/scala.html
Bibliography
http://akka.io , retrieved 2015-04-20
https://en.wikipedia.org/wiki/History_of_the_Actor_model , retrieved
2015-04-12

More Related Content

Viewers also liked

Viewers also liked (18)

Origins of free
Origins of freeOrigins of free
Origins of free
 
Open source big data landscape and possible ITS applications
Open source big data landscape and possible ITS applicationsOpen source big data landscape and possible ITS applications
Open source big data landscape and possible ITS applications
 
Machine learning by example
Machine learning by exampleMachine learning by example
Machine learning by example
 
Deep Introduction to Akka
Deep Introduction to AkkaDeep Introduction to Akka
Deep Introduction to Akka
 
Akka introtalk HyScala DEC 2016
Akka introtalk HyScala DEC 2016Akka introtalk HyScala DEC 2016
Akka introtalk HyScala DEC 2016
 
Introduction to Akka
Introduction to AkkaIntroduction to Akka
Introduction to Akka
 
How secure your web framework is?
How secure your web framework is?How secure your web framework is?
How secure your web framework is?
 
From spaghetti with no `src/test` to green CI and well-sleeping developers
From spaghetti with no `src/test` to green CI and well-sleeping developersFrom spaghetti with no `src/test` to green CI and well-sleeping developers
From spaghetti with no `src/test` to green CI and well-sleeping developers
 
Proste REST API z użyciem play i slick
Proste REST API z użyciem play i slickProste REST API z użyciem play i slick
Proste REST API z użyciem play i slick
 
What is most important 
in cooperation with external software developers? Par...
What is most important 
in cooperation with external software developers? Par...What is most important 
in cooperation with external software developers? Par...
What is most important 
in cooperation with external software developers? Par...
 
Code reviews - Human Factor
Code reviews - Human FactorCode reviews - Human Factor
Code reviews - Human Factor
 
Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?
Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?
Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?
 
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
 
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
 
Projekt z punktu widzenia UX designera
Projekt z punktu widzenia UX designeraProjekt z punktu widzenia UX designera
Projekt z punktu widzenia UX designera
 
An introduction to data virtualization in business intelligence
An introduction to data virtualization in business intelligenceAn introduction to data virtualization in business intelligence
An introduction to data virtualization in business intelligence
 
Arquillian - extensions which you have to take with you to a deserted island
Arquillian - extensions which you have to take with you to a deserted islandArquillian - extensions which you have to take with you to a deserted island
Arquillian - extensions which you have to take with you to a deserted island
 

Similar to An Introduction to Akka

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
 
Scaling Web Apps with Akka
Scaling Web Apps with AkkaScaling Web Apps with Akka
Scaling Web Apps with Akka
Maciej Matyjas
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and Akka
Yung-Lin Ho
 
System Integration with Akka and Apache Camel
System Integration with Akka and Apache CamelSystem Integration with Akka and Apache Camel
System Integration with Akka and Apache Camel
krasserm
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_group
Skills Matter
 
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka StreamsFresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Konrad Malawski
 
Christophe Spring Actionscript Flex Java Exchange
Christophe Spring Actionscript Flex Java ExchangeChristophe Spring Actionscript Flex Java Exchange
Christophe Spring Actionscript Flex Java Exchange
Skills Matter
 

Similar to An Introduction to Akka (20)

Anatomy of a Reactive Application
Anatomy of a Reactive ApplicationAnatomy of a Reactive Application
Anatomy of a Reactive Application
 
Introduction to Akka
Introduction to AkkaIntroduction to Akka
Introduction to Akka
 
Event Sourcing on AWS Using Akka in Java
Event Sourcing on AWS Using Akka in JavaEvent Sourcing on AWS Using Akka in Java
Event Sourcing on AWS Using Akka in Java
 
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
 
Reactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.NetReactive Programming in .Net - actorbased computing with Akka.Net
Reactive Programming in .Net - actorbased computing with Akka.Net
 
Akka and futures
Akka and futuresAkka and futures
Akka and futures
 
Akka lsug skills matter
Akka lsug skills matterAkka lsug skills matter
Akka lsug skills matter
 
Scaling Web Apps with Akka
Scaling Web Apps with AkkaScaling Web Apps with Akka
Scaling Web Apps with Akka
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and Akka
 
Testing akka-actors
Testing akka-actorsTesting akka-actors
Testing akka-actors
 
System Integration with Akka and Apache Camel
System Integration with Akka and Apache CamelSystem Integration with Akka and Apache Camel
System Integration with Akka and Apache Camel
 
Akka Actors: an Introduction
Akka Actors: an IntroductionAkka Actors: an Introduction
Akka Actors: an Introduction
 
Akka london scala_user_group
Akka london scala_user_groupAkka london scala_user_group
Akka london scala_user_group
 
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka StreamsFresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
 
The dark side of Akka and the remedy
The dark side of Akka and the remedyThe dark side of Akka and the remedy
The dark side of Akka and the remedy
 
First glance at Akka 2.0
First glance at Akka 2.0First glance at Akka 2.0
First glance at Akka 2.0
 
Christophe Spring Actionscript Flex Java Exchange
Christophe Spring Actionscript Flex Java ExchangeChristophe Spring Actionscript Flex Java Exchange
Christophe Spring Actionscript Flex Java Exchange
 
Building Stateful Microservices With Akka
Building Stateful Microservices With AkkaBuilding Stateful Microservices With Akka
Building Stateful Microservices With Akka
 
Introduction to akka actors with java 8
Introduction to akka actors with java 8Introduction to akka actors with java 8
Introduction to akka actors with java 8
 
Concurrency and scalability with akka
Concurrency and scalability  with akkaConcurrency and scalability  with akka
Concurrency and scalability with akka
 

More from SoftwareMill

More from SoftwareMill (17)

Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retries
 
How To Survive a Live-Coding Session
How To Survive a Live-Coding SessionHow To Survive a Live-Coding Session
How To Survive a Live-Coding Session
 
Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...
Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...
Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...
 
Have you ever wondered about code review?
Have you ever wondered about code review?Have you ever wondered about code review?
Have you ever wondered about code review?
 
Reactive Integration with Akka Streams and Alpakka
Reactive Integration with Akka Streams and AlpakkaReactive Integration with Akka Streams and Alpakka
Reactive Integration with Akka Streams and Alpakka
 
W świecie botów czyli po co nam SI
W świecie botów czyli po co nam SIW świecie botów czyli po co nam SI
W świecie botów czyli po co nam SI
 
Small intro to Big Data
Small intro to Big DataSmall intro to Big Data
Small intro to Big Data
 
Out-of-the-box Reactive Streams with Java 9
Out-of-the-box Reactive Streams with Java 9Out-of-the-box Reactive Streams with Java 9
Out-of-the-box Reactive Streams with Java 9
 
Hiring, Bots and Beer. (Hiring in the IT industry)
Hiring, Bots and Beer. (Hiring in the IT industry) Hiring, Bots and Beer. (Hiring in the IT industry)
Hiring, Bots and Beer. (Hiring in the IT industry)
 
Teal Is The New Black
Teal Is The New BlackTeal Is The New Black
Teal Is The New Black
 
Windowing data in big data streams
Windowing data in big data streamsWindowing data in big data streams
Windowing data in big data streams
 
Kafka as a message queue
Kafka as a message queueKafka as a message queue
Kafka as a message queue
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
Origins of Free
Origins of FreeOrigins of Free
Origins of Free
 
Cassandra - how to fail?
Cassandra - how to fail?Cassandra - how to fail?
Cassandra - how to fail?
 
How to manage in a flat organized, remote and transparent company
How to manage in a flat organized, remote and transparent companyHow to manage in a flat organized, remote and transparent company
How to manage in a flat organized, remote and transparent company
 
Performance tests with gatling
Performance tests with gatlingPerformance tests with gatling
Performance tests with gatling
 

Recently uploaded

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 

An Introduction to Akka

  • 1. An Introduction to Akka Mikołaj Koziarkiewicz
  • 2. Akka - what is it? 1/2 a platform, "for building highly concurrent, distributed, and resilient message-driven applications on the JVM."[1], based on the actor model.
  • 3. Akka - what is it? 2/2 platform has a lot of specialized extensions all based on the actor core goal of the presentation: explain the core
  • 4. Actor model - what is it? actor: unit of computation actors build actor systems quite "old" (1973).[2]
  • 5. Anatomy of an Akka Actor - intro 1/2 class MyActor extends Actor { def receive = { case Something => //... } }
  • 6. Anatomy of an Akka Actor - intro 2/2
  • 7. My first Akka Actor™ class HaiActor extends Actor { def receive: Receive = { case target: ActorRef => target ! "Hello!" case "Hello!" => sender ! "OHAI" case "OHAI" => println(s"$self: got OHAI from $sender") } } Where: type Receive = PartialFunction[Any, Unit]
  • 8. My first Akka Actor™ - example
  • 9. Anatomy of an Akka Actor - hierarchy
  • 10. Akka actor model - lifecycle & hierarchy Purpose: division of labor supervision: each actor has lifecycle special hooks - preStart, preRestart, postStop allow for e.g. self-init "parent" controls how it reacts to failure
  • 12. Akka - guarantees an actor processes one message at a time, a message will be delivered at most 1 times, messages are ordered by sender
  • 13. Guarantee takeaways don’t pass mutable state, use services to ensure send: contex.scheduler persistence
  • 14. Testing Akka Testkit Features: can run special 1-thread dispatcher asserts for getting msgs TestProbe
  • 16. Talking to actor system Custom: ask pattern ask(actoRef, request)(timeout): Future Many others (also builtin)
  • 17. Summary Akka - actor model on the JVM alternative way to handle concurrency distribution declared guarantees make reasoning easier
  • 18. THANK YOU! The End Doc link: http://doc.akka.io/docs/akka/current/scala.html Bibliography http://akka.io , retrieved 2015-04-20 https://en.wikipedia.org/wiki/History_of_the_Actor_model , retrieved 2015-04-12