Akka in Action
Raymond Roestenburg, Rob Bakker, and Rob Williams
  • MEAP began September 2012
  • Publication in October 2015 (estimated)
  • ISBN 9781617291012
  • 475 pages (estimated)
  • printed in black & white

Akka in Action is a comprehensive tutorial on building message-oriented systems using Akka. The book takes a hands-on approach, where each new concept is followed by an example that shows you how it works, how to implement the code, and how to (unit) test it. You'll learn to test and deploy an actor system and scale it up and out, showing off Akka's fault tolerance. As you move along, you'll explore a message-oriented event-driven application in Akka. You'll also tackle key issues like how to model immutable messages and domain models, and apply patterns like Event Sourcing, and CQRS. The book concludes with practical advice on how to tune and customize a system built with Akka.

Table of Contents show full

1. Introducing Akka

1.1. What is Akka

1.2. Actors: a quick overview

1.3. Two approaches to scaling: Setting up our example

1.4. Traditional scaling

1.4.1. Traditional scaling and durability: "Move everything to the database"

1.4.2. Traditional scaling and interactive use: polling

1.5. Scaling with Akka

1.5.1. Scaling with Akka and durability: sending and receiving messages

1.5.2. Scaling with Akka and interactive use: push messages

1.5.3. Scaling with Akka and failure: asynchronous decoupling

1.5.4. The Akka approach: sending and receiving messages

1.6. Actors: One programming model to rule up and out

1.6.1. An asynchronous model

1.6.2. Actor operations

1.7. Akka actors

1.7.1. ActorSystem

1.7.2. ActorRef, mailbox, and actor

1.7.3. Dispatchers

1.7.4. Actors and the network

1.8. Summary

2. Up and Running

2.1. Clone, build, and test interface

2.1.1. Build with SBT

2.1.2. Fast forward to the GoTicks.com REST server

2.2. Explore the actors in the app

2.2.1. Structure of the app

2.2.2. The Actor that handles the sale: TicketSeller

2.2.3. The BoxOffice actor

2.2.4. RestApi

2.3. Into the cloud

2.3.1. Create the app on Heroku

2.3.2. Deploy and run on Heroku

2.4. Summary

3. Test-driven Development with Actors

3.1. Testing Actors

3.2. One-way messages

3.2.1. SilentActor examples

3.2.2. SendingActor example

3.2.3. SideEffectingActor example

3.3. Two-way messages

3.4. Summary

4. Fault tolerance

4.1. What fault tolerance is (and what it isn’t)

4.1.1. Plain old objects and exceptions

4.1.2. Let it crash

4.2. Actor lifecycle

4.2.1. Start event

4.2.2. Stop event

4.2.3. Restart event

4.2.4. Putting the lifecycle pieces together

4.2.5. Monitoring the lifecycle

4.3. Supervision

4.3.1. Supervisor hierarchy

4.3.2. Predefined strategies

4.3.3. Custom strategies

4.4. Summary

5. Futures

5.1. The use case for Futures

5.2. In the Future nobody blocks

5.2.1. Promises are promises

5.3. Futuristic Errors

5.4. Combining Futures

5.5. Combining futures with actors

5.6. Summary

6. Your first distributed Akka app

6.1. Scaling out

6.1.1. Common network terminology

6.1.2. Reasons for a distributed programming model

6.2. Scaling Out with Remoting

6.2.1. Making the GoTicks app distributed

6.2.2. Remote REPL action

6.2.3. Remote Lookup

6.2.4. Remote deployment

6.2.5. Multi-JVM testing

6.3. Summary

7. Configuration, Logging and Deployment

7.1. Configuration

7.1.1. Trying out Akka configuration

7.1.2. Using defaults

7.1.3. Akka configuration

7.1.4. Multiple systems

7.2. Logging

7.2.1. Logging in an Akka application

7.2.2. Using Logging

7.2.3. Controlling Akka’s logging

7.3. Deploying Actor-based applications

7.4. Summary

8. Structural patterns for actors

8.1. Pipes and Filters

8.1.1. Enterprise integration pattern Pipes and Filters

8.1.2. Pipes and filters in Akka

8.2. Scatter-gather pattern

8.2.1. Applicability

8.2.2. Parallel tasks with Akka

8.2.3. Implement the scatter component using the recipient list

8.2.4. Implementing the gather component with the aggregator pattern

8.2.5. Combining the components into the scatter-gather pattern

8.3. Routing slip pattern

8.4. Summary

9. Routing messages

9.1. The enterprise integration router pattern

9.2. Balance load using Akka routers

9.2.1. Akka pool router

9.2.2. Akka group router

9.2.3. ConsistentHashing router

9.3. Implementing the router pattern using Actors

9.3.1. Content-based routing

9.4. State-based routing

9.4.1. Router implementations

9.5. Summary

10. Message Channels

10.1. Channel types

10.1.1. Point-to-point

10.1.2. Publish-subscribe

10.2. Specialized channels

10.2.1. Dead letter

10.2.2. Guaranteed delivery

10.3. Summary

11. Finite State Machines and Agents

11.1. Using a Finite State Machine

11.1.1. Quick introduction of Finite State Machine

11.1.2. Creating an FSM model

11.2. Implementation of an FSM model

11.2.1. Implementing transitions

11.2.2. Implementing the entry actions

11.2.3. Timers within FSM

11.2.4. Termination of FSM

11.3. Implement shared state using agents

11.3.1. Simple shared state with agents

11.3.2. Waiting for the state update

11.4. Summary

12. System Integration

12.1. Message endpoints

12.1.1. Normalizer

12.1.2. Canonical Data Model

12.2. Implementing endpoints using the Camel Framework

12.2.1. Implement a consumer endpoint receiving messages from an external System

12.2.2. Implement a producer endpoint sending messages to an external System

12.3. Example of implementing a REST interface

12.3.1. The REST example

12.3.2. Implementing a Rest endpoint with Spray

12.4. Summary

13. Clustering

13.1. Why use clustering?

13.2. Cluster membership

13.2.1. Joining the cluster

13.2.2. Leaving the cluster

13.3. Clustered job processing

13.3.1. Starting the cluster

13.3.2. Work distribution using routers

13.3.3. Resilient jobs

13.3.4. Testing the cluster

13.4. Summary

14. Akka persistence

14.1. Recovering state with event sourcing

14.1.1. Updating records in place

14.1.2. Persisting state without updates

14.1.3. Event sourcing for actors

14.2. Persistent actors

14.2.1. Persistent actor

14.2.2. Testing

14.2.3. Snapshots

14.2.4. Serialization

14.3. Clustered persistence

14.3.1. Cluster singleton

14.3.2. Cluster sharding

14.4. Summary

15. Additional performance tips

15.1. Performance analysis

15.1.1. The performance of a system

15.1.2. Performance parameters

15.2. Performance measurement of actors

15.2.1. Collect mailbox data

15.2.2. Collect processing data

15.3. Improving performance by addressing bottlenecks

15.4. Configure dispatcher

15.4.1. Recognizing thread pool problems

15.4.2. Using multiple instances of dispatchers

15.4.3. Changing thread pool size statically

15.4.4. Using a dynamic thread pool size

15.5. Changing thread releasing

15.5.1. Limitations on thread release settings

15.6. Creating own dispatcher

15.7. Summary

16. Looking ahead

16.1. Akka typed

16.2. Akka streams

16.3. Akka HTTP

16.4. Akka distributed data

16.5. Summary

About the Technology

Akka is a Scala-based toolkit that simplifies developing concurrent distributed applications. Akka uses Actors — independently executing processes that communicate via message passing — as the foundation for fault-tolerant applications where individual actors can fail without crashing everything. Perfect for high-volume applications that need to scale rapidly, Akka is an efficient foundation for event-driven systems that want to scale elastically up and out on demand, both on multi-core processors and across server nodes.

About the book

Akka in Action is a comprehensive tutorial on building message-oriented systems using Akka. The book takes a hands-on approach, where each new concept is followed by an example that shows you how it works, how to implement the code, and how to (unit) test it. You'll learn to test and deploy an actor system and scale it up and out, showing off Akka's fault tolerance. As you move along, you'll explore a message-oriented event-driven application in Akka. You'll also tackle key issues like how to model immutable messages and domain models, and apply patterns like Event Sourcing, and CQRS. The book concludes with practical advice on how to tune and customize a system built with Akka.

What's inside

  • Getting concurrency right
  • Using Akka in production
  • Testing concurrent and distributed applications
  • Fault tolerance, supervision, let it crash semantics
  • Performance tuning Actor Systems
  • Extending Akka
  • Clustered actorsystems, running applications in the Cloud
  • Patterns for building message oriented systems

About the reader

This book assumes that you're comfortable with Java and Scala. No prior experience with Akka is needed.

About the authors

Raymond Roestenburg is an experienced software craftsman, polyglot programmer, and software architect. He is an active member of the Scala community, an Akka committer, and contributed to the Akka-Camel module. Rob Bakker is an experienced developer focused on concurrent back-end systems and system integration. He has used Scala and Akka in production from version 0.7. Rob Williams is founder of ontometrics, a practice that has been focused on Java solutions that include machine learning. He first used Actor-based programming a decade ago, and found Akka while looking for someone who had given thought to the idea of supervision, and has used it for several projects since.


Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
MEAP combo $49.99 pBook + eBook
MEAP eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks