我的环境是斯卡拉阿卡和玩!框架。我想知道是否有控制演员系统或任何其他想法的创建。Akka演员系统控制
我的想法是创建一个远程演员,当用户点击购买时将处理授权。所以,我创建的操作方法的远程系统的演员和演员,当用户执行后:
def payment = Action { implicit request =>
var actorObject: Array[String] = new Array[String](23)
val system = ActorSystem("RemoteSystem", ConfigFactory.load.getConfig("remotecreation")
val worker = system.actorOf(Props[authNetActor.AuthNetActorMain].withRouter(FromConfig()), name = "remoteActor")
...
system.shutdown()
}
这里是在application.conf
remotecreation { #user defined name for the configuration
include "common"
akka {
actor {
serialize-messages = on
serialize-creators = on
serializers {
proto = "akka.serialization.ProtobufSerializer"
java = "akka.serialization.JavaSerializer"
arr = "models.ArraySerializer"
}
serialization-bindings {
"com.google.protobuf.Message" = proto
"java.lang.String" = java
"java.util.Arrays" = java
"scala.Array" = arr
"akka.actor.ActorRef" = java
}
deployment {
/remoteActor { #Specifically has to be the name of the remote actor
remote = "akka://[email protected]:2552"
router = "round-robin"
nr-of-instances = 1
}
}
}
remote.netty.port = 2554
}
}
的问题remotecreation的定义我遇到的情况是,当我连续两次提交时,我得到一个错误,因为我试图在一个已经有一个actor系统的ip地址上创建一个actor系统。
我绝对认为我需要移动它,但我不确定在哪里,因为这将是一个广泛的多用户游戏!应用程序,我不确定我可以在哪里将创建演员系统的位置在数百个用户使用该应用程序时不会发生冲突。
任何想法,建议或帮助表示赞赏。
这些例子来自我的一个使用远程scala解释器的玩具项目。 – ron