Akka remoting on Google Cloud VM -


i'm new akka , i'm trying run simple remoting actor works on localhost on google cloud vm instance.

vm has both internal , external ips. when start actor ip set external fails start.

but when i'm doing this

netty.tcp {   hostname = "<internal ip>"   port = 45000 

everything starts off fine.

now when trying connect machine internal ip doesn't resolve, i'm trying find actor using following command:

context.actorselection("akka.tcp://main@<external ip>:45000/user/app") 

and following error:

[error] dropping message [class akka.actor.actorselectionmessage] non-local recipient [actor[akka.tcp://main@external ip:45000/]] arriving @ [akka.tcp://main@external ip:45000] inbound addresses [akka.tcp://main@internal ip:45000]

the last part make sense, how make whole thing work?

found solution.

it's based on bind-hostname config setting available in upcoming 2.4 version:

build.sbt

resolvers += "typesafe snapshots" @ "http://repo.akka.io/snapshots/"  librarydependencies ++= seq(   "com.typesafe.akka" %% "akka-actor" % "2.4-snapshot",   "com.typesafe.akka" %% "akka-remote" % "2.4-snapshot" ) 

application.conf

akka {   actor {     provider = "akka.remote.remoteactorrefprovider"   }   remote {     enabled-transports = ["akka.remote.netty.tcp"]     netty.tcp {       hostname = "external ip"       port = 45000       bind-hostname = "internal ip"     }  } } 

you can specify bind-port if needed.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -