Developing a Chat with Akka

In the previous chapters, we persisted data into MySQL using Slick and wrote PDF reports using Jasper reports. Now we will add more features in our app using Akka.

In this chapter, you will learn how to create Actors using the Akka framework. We will use Actors in combination with the Play framework and WebSockets in order to have a chat capability.

We will cover the following topics in this chapter:

  • • Understanding the Actor model
  • • Actor systems, Actor routing, and dispatchers
  • • Mailboxes, Actor configuration, and persistence
  • • Creating our Chat Application
  • • Testing our Actors

Adding the new UI introduction to Akka

Akka ( is a framework to build concurrent, distributed, and resilient message-driven applications in Scala, Java, and .NET. Building applications with Akka has several advantages, which are as follows:

  • High performance: Akka delivers up to 50 million messages per second on a commodity hardware having ~2.5 million Actors per GB of RAM.
  • Resilient by design: Akka systems have self-healing properties for local and remote Actors.

• Distributed and elastic: Akka has all the mechanisms to scale your application, such as cluster, load balancing, partitioning, and sharding. Akka lets you grow or shrink your Actors on demand.

The Akka framework provides good abstractions for concurrent, asynchronous, and distributed programming, such as Actors, Streams, and Futures. There are plenty of great success cases in production, such as BBC, Amazon, eBay, Cisco, The Guardian, Blizzard, Gilt, HP, HSBC, Netflix, and so many others.

Akka is a truly reactive framework because everything, in the sense of sending and receiving messages to Actors, is lockless, non-blocking IO, and asynchronous.

< Prev   CONTENTS   Source   Next >