问题
I want to start remote actors from my local computer using scala . Can I just start running the actors on the remote computer without manually starting a server program of some kind in the remote computer. I have a master actor which has to start some remote actors. So any ideas on how I should do it? or can I do it without executing some kind of program on the remote computer to which i have to connect first in order to start new remote actors.
回答1:
You would need to have a program running on the remote side that you would have to connect to. In that program have an actor that listens for messages from your local computer and creates other actors.
For example - local side:
remoteActor ! Props(new SomeActor)
Remote side:
def receive = {
case p @ Props(_,_,_,_) =>
val actor = context.actorOf(p)
sender ! actor
//...
}
回答2:
Of course you can't; that'd be an enormous security hole!
See the akka documentation for what you need to run on the remote computer to start an akka service.
来源:https://stackoverflow.com/questions/12340514/how-to-start-remote-actors-in-scala