Search code examples
javaakkaactor

actorSelection with relative path messages going to dead letters


I have created an ActorSystem a synopsis of my system is

akka://JL/user/store/meatProcessor
akka://JL/user/store/Server/

The store contructor looks like this

.....
public Store(){
    server = this.getContext().actorOf(
            Props.create(Server.class)
            .withDispatcher("my-thread-pool-dispatcher")
            .withRouter(new RoundRobinPool(lowerBound)
            .withResizer(resizer)),
            "Server");
....
meatProcessor = this.getContext().actorOf(Props.create(meatProcessor.class)
                            .withRouter(new RoundRobinPool(lowerBound)
                            .withResizer(resizer)),
            "meatProcessor");
......}

So if "store" creates these two actors it should be their parent right?

When I am in in the meatProcessor actor

I try to send a message to the Server with the following

getContext().actorSelection("../Server").tell(new SomeMsg(), getSelf());  

My messages are sent to dead letters.

But it works when I use the Absolute path of

getContext().actorSelection("user/store/Server").tell(new SomeMsg(), getSelf()); 

Can anyone tell me why ".." does not work?


Solution

  • I think this is a bug when using a router.

    I got it to work by doing this

    getContext().actorSelection("../../Server").tell(new SomeMsg(), getSelf());