Creating remote actors on different machines
In this recipe, we are going to see how to create remote actors on different machines. We will need to start two separate Akka applications running on different ports (mimicking as if they are running on different machines) to demonstrate how to do it.
Getting ready
Just import the Hello-Akka
project; the prerequisites are the same as before. We will also need to have the Akka remoting dependency in our build.sbt
file.
How to do it...
- Create a new file named
application-1.conf
in thesrc/main/resources
directory with the following contents:
akka { actor { provider = "akka.remote.RemoteActorRefProvider" } remote { enabled-transports = ["akka.remote.netty.tcp"] netty.tcp { hostname = "127.0.0.1" port = 2552 } } }
- Create a second new file named
application-2.conf
in thesrc/main/resources
directory with the following contents...