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:
To create an actor, Akka provides a construct called
Props is a configuration class, which takes in the actor along with the various configurations that need to be applied to it.
Let's first take an example of creating an