SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
Akka:
 The Smash and Grab Intro
  The Basics of Sane Concurrency

 Jeremy Pierre
 Yet Another Developer
 @ j14159


twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Akka What?


                                 Don’t call it a framework

                                                   So...?

         A toolkit for sane concurrency.
                        • Not just about actors
                        • Blocking is bad, event-based is good
                        • Crashing is not the end of the world




twitter.com/hootsuite            facebook.com/hootsuite     slideshare.com/hootsuite   blog.hootsuite.com
The Overview
 What I’ll Cover:
                        • Actors and ActorSystems
                        • Supervision(in passing)
                        • Futures and Promises
                        • Some interesting stuff with execution
                        contexts, event buses and schedulers




twitter.com/hootsuite           facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
The Overview
 What I’ll Cover:
                        • Actors and ActorSystems
                        • Supervision(in passing)
                        • Futures and Promises
                        • Some interesting stuff with execution
                        contexts, event buses and schedulers
 What I’m Not Covering

                        • Remoting
                        • FSM
                        • Routing/Dispatchers
                        • IO


twitter.com/hootsuite           facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
To help it all make sense...

    We use the Librarian Problem:

• A Library has one Librarian but many Interns.
• Interns do not know where to find specific books.
• The Librarian can’t go find books for customers because they can then only help one
at a time.

• If the Librarian tells the Interns where to find stuff, many book requests can be
handled at the same time.




   twitter.com/hootsuite   facebook.com/hootsuite     slideshare.com/hootsuite   blog.hootsuite.com
Akka Actors

       The logical extreme of OOP and Information Hiding



• There’s only one method
to make it do stuff(tell / !)
• They’re purely event-
based
• They live in ActorSystems




    twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
ActorSystem




            • They make ActorRefs
            • They’re the root of a hierarchy(think file system)




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
ActorSystem




            • They make ActorRefs
            • They’re the root of a hierarchy(think file system)




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
ActorSystem




            • They make ActorRefs
            • They’re the root of a hierarchy(think file system)




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Futures...

   ...let us do asynchronous stuff without an Actor




                        But where’s the result?




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Futures...

   ...let us do asynchronous stuff without an Actor




                        But where’s the result?




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Promises

 The “write” side of Futures




                        But that looks kind of boring...




twitter.com/hootsuite       facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Promises

 The “write” side of Futures




                        But that looks kind of boring...




twitter.com/hootsuite       facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
One more Promise




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Using the results of Future/Promise

       As you’d expect, this gives you another Future:



                        This callback is for side-effecting:




twitter.com/hootsuite         facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Event Bus and Scheduler

 EventBus is (very) simple pub-sub for Actors:




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Event Bus and Scheduler

  EventBus is (very) simple pub-sub for Actors:




                                    Scheduler?
"Thread.sleep is never fine. It's like drowning a kitten."
                    - @viktorklang
 twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Event Bus and Scheduler

 EventBus is (very) simple pub-sub for Actors:




 Scheduler makes stuff happen when you want it to:




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Asking and Piping
   import akka.pattern.ask




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Asking and Piping
   import akka.pattern.ask




   import akka.pattern.pipe




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
ExecutionContext

 Futures and Promises need it


 • It basically hides a java.util.concurrent.Executor
 • Your ActorSystem’s dispatcher is one
 • You can create them via configuration or programmatically




twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Mix Them!




Never block your ActorSystem’s threads for DB calls!

twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com
Thank You!
 Jeremy Pierre
 Yet Another Developer
 @j14159



twitter.com/hootsuite   facebook.com/hootsuite   slideshare.com/hootsuite   blog.hootsuite.com

Weitere ähnliche Inhalte

Ähnlich wie Akka smash-and-grab

Give them homework they will love rs
Give them homework they will love rsGive them homework they will love rs
Give them homework they will love rsNatasa Bozic Grojic
 
Make Stuff People Can Use - Agile Alliance 2010
Make Stuff People Can Use - Agile Alliance 2010Make Stuff People Can Use - Agile Alliance 2010
Make Stuff People Can Use - Agile Alliance 2010Samantha Starmer
 
Powerpoint: taking a 20th century tool into the 21st century classroom
Powerpoint: taking a 20th century tool into the 21st century classroomPowerpoint: taking a 20th century tool into the 21st century classroom
Powerpoint: taking a 20th century tool into the 21st century classroomNaomi Bates
 
The Great Eleven - Ohio Version
The Great Eleven - Ohio VersionThe Great Eleven - Ohio Version
The Great Eleven - Ohio VersionChristopher Bugaj
 
Give them homework they will love rsss
Give them homework they will love rsssGive them homework they will love rsss
Give them homework they will love rsssNatasa Bozic Grojic
 
Ohio Innovative Learning Digital Wriitng
Ohio Innovative Learning Digital WriitngOhio Innovative Learning Digital Wriitng
Ohio Innovative Learning Digital WriitngFranki22
 
Region 11 Main Presentation-Flipped Learning
Region 11 Main Presentation-Flipped LearningRegion 11 Main Presentation-Flipped Learning
Region 11 Main Presentation-Flipped LearningJon Bergmann
 
Social Media Tools That Work
Social Media Tools That WorkSocial Media Tools That Work
Social Media Tools That WorkJeffrey L. Cohen
 
In It Together: Co-Creating Your Content Strategy
In It Together: Co-Creating Your Content StrategyIn It Together: Co-Creating Your Content Strategy
In It Together: Co-Creating Your Content StrategySara Wachter-Boettcher
 
TCCA 2014 Apps presentatio
TCCA 2014 Apps presentatioTCCA 2014 Apps presentatio
TCCA 2014 Apps presentatioKarin Perry
 
Twitter For Education and Private Schools - Webinar 10/23/12
Twitter For Education and Private Schools - Webinar 10/23/12Twitter For Education and Private Schools - Webinar 10/23/12
Twitter For Education and Private Schools - Webinar 10/23/12Evolving SEO
 
Smash Summit 2011: YouTube
Smash Summit 2011: YouTubeSmash Summit 2011: YouTube
Smash Summit 2011: YouTubeShiva Rajaraman
 
Blogging-This is an assignment for a course at Minnesota State University, Ma...
Blogging-This is an assignment for a course at Minnesota State University, Ma...Blogging-This is an assignment for a course at Minnesota State University, Ma...
Blogging-This is an assignment for a course at Minnesota State University, Ma...booerin
 
To Tweet or Not to Tweet - for Construction Professionals
To Tweet or Not to Tweet - for Construction ProfessionalsTo Tweet or Not to Tweet - for Construction Professionals
To Tweet or Not to Tweet - for Construction ProfessionalsSu Butcher
 
Developing Effective Presentations
Developing Effective PresentationsDeveloping Effective Presentations
Developing Effective PresentationsLaDonna Coy
 
Power Up Your PLN Revised
Power Up Your PLN RevisedPower Up Your PLN Revised
Power Up Your PLN RevisedJennifer Dorman
 
Twitter apps - Pubcon2010
Twitter apps - Pubcon2010Twitter apps - Pubcon2010
Twitter apps - Pubcon2010Brian Breslin
 

Ähnlich wie Akka smash-and-grab (20)

Give them homework they will love rs
Give them homework they will love rsGive them homework they will love rs
Give them homework they will love rs
 
Make Stuff People Can Use - Agile Alliance 2010
Make Stuff People Can Use - Agile Alliance 2010Make Stuff People Can Use - Agile Alliance 2010
Make Stuff People Can Use - Agile Alliance 2010
 
Technologies
Technologies Technologies
Technologies
 
TwitterPD
TwitterPDTwitterPD
TwitterPD
 
Powerpoint: taking a 20th century tool into the 21st century classroom
Powerpoint: taking a 20th century tool into the 21st century classroomPowerpoint: taking a 20th century tool into the 21st century classroom
Powerpoint: taking a 20th century tool into the 21st century classroom
 
The Great Eleven - Ohio Version
The Great Eleven - Ohio VersionThe Great Eleven - Ohio Version
The Great Eleven - Ohio Version
 
Give them homework they will love rsss
Give them homework they will love rsssGive them homework they will love rsss
Give them homework they will love rsss
 
Ohio Innovative Learning Digital Wriitng
Ohio Innovative Learning Digital WriitngOhio Innovative Learning Digital Wriitng
Ohio Innovative Learning Digital Wriitng
 
Region 11 Main Presentation-Flipped Learning
Region 11 Main Presentation-Flipped LearningRegion 11 Main Presentation-Flipped Learning
Region 11 Main Presentation-Flipped Learning
 
Social Media Tools That Work
Social Media Tools That WorkSocial Media Tools That Work
Social Media Tools That Work
 
In It Together: Co-Creating Your Content Strategy
In It Together: Co-Creating Your Content StrategyIn It Together: Co-Creating Your Content Strategy
In It Together: Co-Creating Your Content Strategy
 
TCCA 2014 Apps presentatio
TCCA 2014 Apps presentatioTCCA 2014 Apps presentatio
TCCA 2014 Apps presentatio
 
Twitter For Education and Private Schools - Webinar 10/23/12
Twitter For Education and Private Schools - Webinar 10/23/12Twitter For Education and Private Schools - Webinar 10/23/12
Twitter For Education and Private Schools - Webinar 10/23/12
 
Smash Summit 2011: YouTube
Smash Summit 2011: YouTubeSmash Summit 2011: YouTube
Smash Summit 2011: YouTube
 
Blogging-This is an assignment for a course at Minnesota State University, Ma...
Blogging-This is an assignment for a course at Minnesota State University, Ma...Blogging-This is an assignment for a course at Minnesota State University, Ma...
Blogging-This is an assignment for a course at Minnesota State University, Ma...
 
ontopwiki.pdf
ontopwiki.pdfontopwiki.pdf
ontopwiki.pdf
 
To Tweet or Not to Tweet - for Construction Professionals
To Tweet or Not to Tweet - for Construction ProfessionalsTo Tweet or Not to Tweet - for Construction Professionals
To Tweet or Not to Tweet - for Construction Professionals
 
Developing Effective Presentations
Developing Effective PresentationsDeveloping Effective Presentations
Developing Effective Presentations
 
Power Up Your PLN Revised
Power Up Your PLN RevisedPower Up Your PLN Revised
Power Up Your PLN Revised
 
Twitter apps - Pubcon2010
Twitter apps - Pubcon2010Twitter apps - Pubcon2010
Twitter apps - Pubcon2010
 

Kürzlich hochgeladen

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Akka smash-and-grab

  • 1. Akka: The Smash and Grab Intro The Basics of Sane Concurrency Jeremy Pierre Yet Another Developer @ j14159 twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 2. Akka What? Don’t call it a framework So...? A toolkit for sane concurrency. • Not just about actors • Blocking is bad, event-based is good • Crashing is not the end of the world twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 3. The Overview What I’ll Cover: • Actors and ActorSystems • Supervision(in passing) • Futures and Promises • Some interesting stuff with execution contexts, event buses and schedulers twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 4. The Overview What I’ll Cover: • Actors and ActorSystems • Supervision(in passing) • Futures and Promises • Some interesting stuff with execution contexts, event buses and schedulers What I’m Not Covering • Remoting • FSM • Routing/Dispatchers • IO twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 5. To help it all make sense... We use the Librarian Problem: • A Library has one Librarian but many Interns. • Interns do not know where to find specific books. • The Librarian can’t go find books for customers because they can then only help one at a time. • If the Librarian tells the Interns where to find stuff, many book requests can be handled at the same time. twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 6. Akka Actors The logical extreme of OOP and Information Hiding • There’s only one method to make it do stuff(tell / !) • They’re purely event- based • They live in ActorSystems twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 7. ActorSystem • They make ActorRefs • They’re the root of a hierarchy(think file system) twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 8. ActorSystem • They make ActorRefs • They’re the root of a hierarchy(think file system) twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 9. ActorSystem • They make ActorRefs • They’re the root of a hierarchy(think file system) twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 10. Futures... ...let us do asynchronous stuff without an Actor But where’s the result? twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 11. Futures... ...let us do asynchronous stuff without an Actor But where’s the result? twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 12. Promises The “write” side of Futures But that looks kind of boring... twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 13. Promises The “write” side of Futures But that looks kind of boring... twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 14. One more Promise twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 15. Using the results of Future/Promise As you’d expect, this gives you another Future: This callback is for side-effecting: twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 16. Event Bus and Scheduler EventBus is (very) simple pub-sub for Actors: twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 17. Event Bus and Scheduler EventBus is (very) simple pub-sub for Actors: Scheduler? "Thread.sleep is never fine. It's like drowning a kitten." - @viktorklang twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 18. Event Bus and Scheduler EventBus is (very) simple pub-sub for Actors: Scheduler makes stuff happen when you want it to: twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 19. Asking and Piping import akka.pattern.ask twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 20. Asking and Piping import akka.pattern.ask import akka.pattern.pipe twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 21. ExecutionContext Futures and Promises need it • It basically hides a java.util.concurrent.Executor • Your ActorSystem’s dispatcher is one • You can create them via configuration or programmatically twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 22. Mix Them! Never block your ActorSystem’s threads for DB calls! twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com
  • 23. Thank You! Jeremy Pierre Yet Another Developer @j14159 twitter.com/hootsuite facebook.com/hootsuite slideshare.com/hootsuite blog.hootsuite.com