O'Reilly logo

Akka Essentials by Munish K. Gupta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating actors

Once an actor is defined, the Actor instance needs to be created and started. All actors are created in the context of an actor system or another actor. As part of the actor creation itself, the actor gets started. Before it starts accepting and processing messages, the actor can implement a method called preStart, which can handle any initialization required by the actor:

Creating actors

To create an actor, Akka provides a construct called Props. Props is a configuration class, which takes in the actor along with the various configurations that need to be applied to it.

Actor with default constructor

Let's first take an example of creating an

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required