In this section, we will compare the two important components of an Akka Actor:
- ActorRef: ActorRef is a reference of an Actor object. When we create an Actor using ActorSystem, it returns ActorRef but not an Actor object:
val actorRef:ActorRef =
actorSystem.actorOf(Props[SimpleActor],"SimpleActor")
As the outside world cannot interact with an Actor object directly, an outside Actor or a non-Actor can interact with another Actor indirectly using this ActorRef. When we create another Actor, ActorSystem returns a different ActorRef to that newly created Actor.
ActorRef is the same for a single Actor. It does not change during an Actor lifecycle. Two different Actor objects cannot have the same ActorRef.
- ActorPath: ActorPath is the address of an Actor in the ActorSystem. In Akka, Actors are created in the hierarchy fashion...