how to start remote actors in scala

戏子无情 提交于 2019-12-24 07:15:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!