I have an ActorSystem running on port 2552 and another running on port 2553. Each of them create an Actor which instantiates a singleton object. I now want to create another system that manages both of these systems and can reference these actors in order to make use of the singletons simultaneously.
I know the actors are listening on the port because it gives me a log like this for each port
Remoting started; listening on addresses :[akka.tcp://singletonApplication@127.0.0.1:2552]
and it when I look at the object using the debugger the actor shows up like this
Actor[akka://singletonApplication/user/singleton]
I create the manager system using
ActorSystem system = ActorSystem.create("managerSystem");
but when I try and reference the remote actors by the following line
system.actorSelection("akka.tcp://singletonApplication@127.0.0.1:2552/user/singleton");
It gives me this in the object
ActorSelection[Actor[akka://managerApplication/deadLetters]/user/singleton]
and when I try and send it a message it gives me a deadletter error log in the console I am not really sure what I doing wrong but it looks like the system I am trying to use to look up the remote actors is messing up my actorSelection call. Do I need to be within the same system in order to reference a remote actor? I thought this was one of the points to using akka?
You are saying that you are accessing the remote actor from a different system. But i see that you are using 127.0.0.1 to address the remote system. 127.0.0.1 is a special loopback address and refers to the local machine. So you need to give addressable IP to access remote machine.
For more on Loopback check this http://en.wikipedia.org/wiki/Loopback
This is also clearly stated in the documentation :
"Note
Be sure to replace the default IP 127.0.0.1 with the real address the system is reachable by if you deploy onto multiple machines! "
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.