Sample game! The framework application can connect to a remote Akka node (i.e. your node wizard) using a simple configuration.
There are two ways:
- override the default action system
- define a new acting system
I suggest you use the second one. In this case, you need to add something like to application.conf
master { akka { actor { provider = "akka.remote.RemoteActorRefProvider" } remote { transport = "akka.remote.netty.NettyRemoteTransport" netty { hostname = "your-master-host-name" port = 0 } } } }
Then in your game! app, you can connect to the remote node wizard this way
ActorSystem system = ActorSystem.create("master", ConfigFactory.load().getConfig("master")) ActorRef master = system.actorFor("akka:// master@your-master-host-name :your-master-port/user/master")
If you prefer to redefine your current Play Akque acting system by default. Here is the reference configuration: http://www.playframework.org/documentation/2.0.3/AkkaCore
For the nodes of the main and computing clusters, I suggest you use the architecture and code described here: http://letitcrash.com/post/29044669086/balancing-workload-across-nodes-with-akka-2
If your wizard and compute nodes do not need a web interface or a REST interface, you can implement them as a simple Java program.
In the cited article, nodes are not displayed remotely. To do this, simply add application.conf to the master node app:
master { akka { actor { provider = "akka.remote.RemoteActorRefProvider" } remote { transport = "akka.remote.netty.NettyRemoteTransport" netty { hostname = "your-master-host-name" port = your-master-port } } } }
And create it using actorOf method
ActorSystem system = ActorSystem.create("master", ConfigFactory.load().getConfig("master")) ActorRef master = system.actorOf(new Props(Master.class), "master")
Compute nodes must be configured in the same way as in Play! node.
Note that only the node wizard has a TCP-IP port. Non-master nodes use port 0, which configure Akka to select an arbitrary free port for them. This is correct because the only known host: the port address you need is the main one, where each node, when it starts, should point to.