Creating actors

Next we will go ahead and try creating the TypedActor objects within the ActorSystem context.

An actor with a default constructor

When the typed actor implementation has a default constructor, it is constructed using the following syntax.


ActorSystem _system = ActorSytem.create("TypedActorsExample");
CalculatorInt calculator = TypedActor.get(_system)
  .typedActorOf(new TypedProps<Calculator>(
  CalculatorInt.class,	Calculator.class));


    val _system = ActorSystem("TypedActorsExample")
    val calculator1: CalculatorInt =

The typed actor has been implemented as an Akka extension. So to get hold of the extension, the following call gets the extension object—TypedActor.get(_system) ...

Get Akka Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.