Akka in Action
Raymond Roestenburg, Rob Bakker, and Rob Williams
  • September 2016
  • ISBN 9781617291012
  • 448 pages
  • printed in black & white

The most readable and up-to-date treatment of Akka I have seen.

Kevin Esler, TimeTrade Systems

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.

Listen to this book in liveAudio! liveAudio integrates a professional voice recording with the book’s text, graphics, code, and exercises in Manning’s exclusive liveBook online reader. Use the text to search and navigate the audio, or download the audio-only recording for portable offline listening. You can purchase or upgrade to liveAudio here or in liveBook.

About the Technology

Akka makes it relatively easy to build applications in the cloud or on devices with many cores that efficiently use the full capacity of the computing power available. It's a toolkit that provides an actor programming model, a runtime, and required support tools for building scalable applications.

About the book

Akka in Action shows you how to build message-oriented systems with Akka. This comprehensive, hands-on tutorial introduces each concept with a working example. You'll start with the big picture of how Akka works, and then quickly build and deploy a fully functional REST service out of actors. You'll explore test-driven development and deploying and scaling fault-tolerant systems. After mastering the basics, you'll discover how to model immutable messages, implement domain models, and apply techniques like event sourcing and CQRS. You'll also find a tutorial on building streaming applications using akka-stream and akka-http. Finally, you'll get practical advice on how to customize and extend your Akka system.

Table of Contents detailed table of contents

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.4.3. 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.3.2. State-based routing

9.3.3. Router implementations

9.4. 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. Streaming

13.1. Basic stream processing

13.1.1. Copying files with sources and sinks

13.1.2. Materializing runnable graphs

13.1.3. Processing events with flows

13.1.4. Handling errors in streams

13.1.5. Creating a protocol with a BidiFlow

13.2. Streaming HTTP

13.2.1. Receiving a stream over HTTP

13.2.2. Responding with a stream over HTTP

13.2.3. Custom marshallers and unmarshallers for content type and negotiation

13.3. Fan in and fan out with the graph DSL

13.3.1. Broadcasting to flows

13.3.2. Merging flows

13.4. Mediating between producers and consumers

13.4.1. Using buffers

13.5. Rate-detaching parts of a graph

13.5.1. Slow consumer, rolling up events into summaries

13.5.2. Fast consumer, expanding metrics

13.6. Summary

14. Clustering

14.1. Why use clustering?

14.2. Cluster membership

14.2.1. Joining the cluster

14.2.2. Leaving the cluster

14.3. Clustered job processing

14.3.1. Starting the cluster

14.3.2. Work distribution using routers

14.3.3. Resilient jobs

14.3.4. Testing the cluster

14.4. Summary

15. Actor persistence

15.1. Recovering state with event sourcing

15.1.1. Updating records in place

15.1.2. Persisting state without updates

15.1.3. Event sourcing for actors

15.2. Persistent actors

15.2.1. Persistent actor

15.2.2. Testing

15.2.3. Snapshots

15.2.4. Serialization

15.3. Clustered persistence

15.3.1. Cluster singleton

15.3.2. Cluster sharding

15.4. Summary

16. Performance tips

16.1. Performance analysis

16.1.1. The performance of a system

16.1.2. Performance parameters

16.2. Performance measurement of actors

16.2.1. Collect mailbox data

16.2.2. Collect processing data

16.3. Improving performance by addressing bottlenecks

16.4. Configure dispatcher

16.4.1. Recognizing thread pool problems

16.4.2. Using multiple instances of dispatchers

16.4.3. Changing thread pool size statically

16.4.4. Using a dynamic thread pool size

16.5. Changing thread releasing

16.5.1. Limitations on thread release settings

16.6. Summary

17. Looking ahead

17.1. Akka-typed module

17.2. Akka distributed data

17.3. Summary

What's inside

  • Getting concurrency right
  • Testing and performance tuning
  • Clustered and cloud-based applications
  • Covers Akka version 2.4

About the reader

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

About the authors

A software craftsman and architect, Raymond Roestenburg is an Akka committer. Rob Bakker specializes in concurrent back-end systems and systems integration. Rob Williams has more than 20 years of product development experience.

placing your order...

Don't refresh or navigate away from the page.
print book $37.49 $49.99 pBook + eBook + liveBook
Additional shipping charges may apply
Akka in Action (print book) added to cart
continue shopping
go to cart

eBook $29.99 $39.99 3 formats + liveBook
Akka in Action (eBook) added to cart
continue shopping
go to cart

Add liveAudio for only $19.99
Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks