SlideShare a Scribd company logo
& the actor model
What is Akka?
A toolkit that provides:
simple concurrency
resiliency
elasticity
high performance
What is an actor?
Receive and send messages
Define behavior for
next message
Create other actors
The Actor model of computation
processing - behavior
storage - state model
I/O - messages
Key things to understand
messages processed sequentially
multiple actors can be working at the same time
actors are not threads
an actor can block (but should minimize it)
no shared state
A very simple actor
class MyActor extends Actor with ActorLogging {
def receive = {
case msg ⇒
log.info(“Received: {}”, msg)
}
}
Creating actors in an actor system
Everything begins here:
val system = ActorSystem("example")
val myActor = system.actorOf(Props[MyActor],
name = “myActor”)
myActor ! “a boring message”
Messages
Can be any object
Should be immutable
Should be serializable
Ideally define a protocol for communication
Protocol
“a system of rules that explain the
correct conduct and procedures to
be followed in formal situations”
— Merriam-Webster
Message protocols
Define the interaction between actors
Specify clear boundaries
Encode success and failure clearly
Message protocols
trait Response
case class Success(res: Array[Byte]) extends Response
case class Failure(err: String) extends Response
Actor System
Actor System
system.actorOf(Props[A], name = “A”)
Actor System
context.actorOf(Props[C], name = “C”)
Actor System
A is now the supervisor for D
Actor System
An exception occurs in D
Actor System
A declares a ‘Restart’ for the given exception.
Actor System
override val supervisorStrategy =
OneForOneStrategy(maxNrOfRetries = 10,
withinTimeRange = 1 minute) {
case _: SomeException ⇒ Restart
case _: Exception ⇒ Escalate
}
Actor System
Extras
● Supervisors
○ provide exception handling
○ “let it crash”
○ orthogonal to actor behavior
● Location transparency
○ abstracts the idea of “where” an actor lives
Extras
● Mailboxes
● Routing
○ e.g., round-robin, smallest mailbox, etc.
● Dispatching
○ essentially how to allocate thread resources
Thank you!

More Related Content

PDF
Introduction to Actor Model and Akka
PPTX
Akka framework
KEY
Introduction to Actor Model and Akka
PDF
Introduction to the Actor Model
PDF
Actor model : A Different Concurrency Approach
PPTX
Actor-based concurrency and Akka Fundamentals
PPTX
Actor Model & Reactive Manifesto
PDF
Introduction to Actor Model and Akka
Akka framework
Introduction to Actor Model and Akka
Introduction to the Actor Model
Actor model : A Different Concurrency Approach
Actor-based concurrency and Akka Fundamentals
Actor Model & Reactive Manifesto

What's hot (20)

DOCX
Ruby Interview Questions
PDF
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
PDF
Actor Patterns and NATS - Boulder Meetup
PPTX
C#: Understanding ConfigureAwait(false)
PPTX
Driver
PPTX
Understanding react hooks
ODP
Drilling the Async Library
PPTX
Scope demystified - AngularJS
PPTX
OOP - Java is pass-by-value
PPTX
React hooks
PPTX
Akka - young fighter course
PDF
Dive into Akka Actors
PDF
Lecture1
PDF
Javascript classes and scoping
PPTX
Services Factory Provider Value Constant - AngularJS
PPTX
Nairobi JVM meetup : Introduction to akka
 
PDF
Advanced Reflection in Pharo
PPTX
Akka Actors
PDF
Get Functional Programming with Clojure
PPTX
JS - Basics
Ruby Interview Questions
Full-Stack, Message-oriented Programming w/ Akka.NET Actors
Actor Patterns and NATS - Boulder Meetup
C#: Understanding ConfigureAwait(false)
Driver
Understanding react hooks
Drilling the Async Library
Scope demystified - AngularJS
OOP - Java is pass-by-value
React hooks
Akka - young fighter course
Dive into Akka Actors
Lecture1
Javascript classes and scoping
Services Factory Provider Value Constant - AngularJS
Nairobi JVM meetup : Introduction to akka
 
Advanced Reflection in Pharo
Akka Actors
Get Functional Programming with Clojure
JS - Basics
Ad

Viewers also liked (20)

PDF
Introducing Akka
PDF
Introduction to Akka
PPTX
Akka Actor presentation
PDF
Building Reactive Systems with Akka (in Java 8 or Scala)
PDF
Akka cluster overview at 010dev
PDF
Akka in 100 slides or less
PPTX
The Actor Model - Towards Better Concurrency
PDF
Akka Cluster in Java - JCConf 2015
KEY
Actors and Threads
PDF
Akka Cluster in Production
PDF
Slides - Intro to Akka.Cluster
PDF
Zen of Akka
PPTX
Go lang - What is that thing?
PPT
Introduction to Play Framework
PDF
ReST Vs SOA(P) ... Yawn
PPTX
Akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인 발표자료)
PPTX
Developing distributed applications with Akka and Akka Cluster
PDF
Go Lang Tutorial
PDF
End to End Akka Streams / Reactive Streams - from Business to Socket
PDF
Akka streams
Introducing Akka
Introduction to Akka
Akka Actor presentation
Building Reactive Systems with Akka (in Java 8 or Scala)
Akka cluster overview at 010dev
Akka in 100 slides or less
The Actor Model - Towards Better Concurrency
Akka Cluster in Java - JCConf 2015
Actors and Threads
Akka Cluster in Production
Slides - Intro to Akka.Cluster
Zen of Akka
Go lang - What is that thing?
Introduction to Play Framework
ReST Vs SOA(P) ... Yawn
Akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인 발표자료)
Developing distributed applications with Akka and Akka Cluster
Go Lang Tutorial
End to End Akka Streams / Reactive Streams - from Business to Socket
Akka streams
Ad

Similar to Akka - A Brief Intro (20)

PDF
Actor Model Akka Framework
PDF
Introducing Akka
PDF
Akka-intro-training-public.pdf
PDF
Akka Actors: an Introduction
PDF
Akka introtalk HyScala DEC 2016
PDF
Introduction to Akka
PPTX
Reactive Programming using Actor Model in Akka
PPTX
Fundamentals of Akka - Webinar
PDF
Introduction to Akka
PDF
Introduction to concurrent programming with akka actors
PDF
Introduction to concurrent programming with Akka actors
PPTX
Introduction to actor model with examples on Akka.NET
PPTX
Creating scalable message driven solutions akkadotnet
PPTX
Oop2011 actor presentation_stal
PDF
A gentle introduction into AKKA and the actor model
PPTX
Introduction to Akka - Atlanta Java Users Group
PDF
Building Massively Scalable application with Akka 2.0
PDF
Daniela Sfregola - Intro to Akka
PDF
Scala Italy 2015 - An Introduction to Akka and the Actor Based Model
PDF
Akka (1)
Actor Model Akka Framework
Introducing Akka
Akka-intro-training-public.pdf
Akka Actors: an Introduction
Akka introtalk HyScala DEC 2016
Introduction to Akka
Reactive Programming using Actor Model in Akka
Fundamentals of Akka - Webinar
Introduction to Akka
Introduction to concurrent programming with akka actors
Introduction to concurrent programming with Akka actors
Introduction to actor model with examples on Akka.NET
Creating scalable message driven solutions akkadotnet
Oop2011 actor presentation_stal
A gentle introduction into AKKA and the actor model
Introduction to Akka - Atlanta Java Users Group
Building Massively Scalable application with Akka 2.0
Daniela Sfregola - Intro to Akka
Scala Italy 2015 - An Introduction to Akka and the Actor Based Model
Akka (1)

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Machine Learning_overview_presentation.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Approach and Philosophy of On baking technology
PDF
Spectral efficient network and resource selection model in 5G networks
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
MIND Revenue Release Quarter 2 2025 Press Release
Assigned Numbers - 2025 - Bluetooth® Document
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Programs and apps: productivity, graphics, security and other tools
Machine Learning_overview_presentation.pptx
Spectroscopy.pptx food analysis technology
Approach and Philosophy of On baking technology
Spectral efficient network and resource selection model in 5G networks
The AUB Centre for AI in Media Proposal.docx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
MYSQL Presentation for SQL database connectivity
Machine learning based COVID-19 study performance prediction
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Building Integrated photovoltaic BIPV_UPV.pdf

Akka - A Brief Intro