Chapter 2. Getting started with Akka
This chapter covers
- Building an actor system
- Distributing and scaling horizontally
- Applying reactive principles
You understand from chapter 1 the tenets of reactive design, but haven’t yet seen them in practice. This chapter changes that situation. In this chapter, you build a simple reactive system by using the actor model that was introduced in chapter 1. The actor model is one of the most common reactive patterns. Actors can send and receive messages, make local decisions, create new actors, and do all that asynchronously and without locks. You build the example in this chapter with the Akka toolkit, which you also saw previously. Akka is a powerful system for creating and running actors. It’s written in the Scala language, and the examples in this chapter are also written in Scala. Chapters 3 and 4 explain Akka in more depth.
The system you build consists of two actors passing messages to each other; you can use the same skills to create much larger applications. Next, you’ll learn to scale the system horizontally by adding more copies of one of the actors. Finally, you’ll see how this approach produces a system that’s both message-driven and elastic—two of the four reactive properties from the Reactive Manifesto.