Search code examples
javaakkaactor

How to get akka's actor name in Java?


i'm new to Akka and Im trying to make a simple project which is aquarium with fishes. The problem is I dont know how to get actor's name which i declared in this line

final ActorRef fish1 = system.actorOf(Props.create(Fish.class), "Dora");

I tried this:

public Fish{
        String actorName = self.path.name;
    }

but "self has private access in 'akka.actor.AbstractActor'"


Solution

  • Did you tried to use getSelf() instead self?