I was wondering if there was a way to obtain the ip address of a remote akka actor because currently I am using a broadcast ip address to set up the actor system (this is the only one that seems to work). I currently am able to see the actor path, but would like to know exactly what machine it resides since the broadcast ip is for the network.
Here is some of my code for the master actor:
# remote actor config
remotecreation{ #user defined name for the configuration
include "common"
akka {
actor{
deployment{
/remoteActor{ #Specifically has to be the name of the remote actor
router = "round-robin"
nr-of-instances = 10
target {
nodes = ["akka://[email protected]:2554", "akka://[email protected]:2554"]
}
}
}
}
remote.netty.port = 2554
}
remote{
log-received-messages = on
log-sent-messages = on
}
}
Here is the Master definition:
class Master(goodies: AuthNetActorObject) extends Actor {
var start: Long = _ // helps measure the calculation time
def receive = {
case "start" => {
System.out.println("Master Started!")
System.out.println("The master is at: " + self.path.toString())
...
}
}
}
Here is where I initialize and bang the actor:
object Payment extends Controller {
var goodies: AuthNetActorObject = null
val system = ActorSystem("RemoteCreation",ConfigFactory.load.getConfig("remotecreation"))
...
val master = system.actorOf(Props(new Master(actorObject)))
master ! "start"
...
}
Use
actorRef.path.address.host