Akka remote configuration unnamed actors -
i'm newbie akka developer , i've started remoting. i'm seeing type of configuration:
akka { actor { provider = "akka.remote.remoteactorrefprovider" deployment { "/mainrepository/*" { remote = "akka.tcp://mqttremote@127.0.0.1:2553" } } } remote { netty.tcp { hostname = "127.0.0.1" } } remote.netty.tcp.port = 2553 } where actors named, example "mainrepository" if want create unnamed remote actors? should specify in configuration? or can accomplish not setting name parameter in actorsystem when requesting new actor?
also, "*" character mean? or can learn more remote configuration? (aside akka.io)
what config saying if actor instances created under path /user/mainrepository/* (that is, children of actor instance bound name /user/mainrepository) should not deployed local actorsystem should instead use remote daemon of remote system mqttremote@127.0.0.1:2553 deploy actor in remote system. if like:
context.actorof(props[myactor], "foo") where context actorcontext mainrepository actor instance, child deployed remotely.
the * wildcard lets more general actors deployed remotely. if config this:
"/mainrepository/foo" { remote = "akka.tcp://mqttremote@127.0.0.1:2553" } then child bound name foo remotely deployed. other children mainrepository actor deployed local actorsystem.
so using approach, wildcard, can indeed create unnamed children , have them deployed remotely, long parent named , name configured (as in example) deploy it's children remotely.
you can programmatically deploy actor instances remotely if using config driven approach not appeal you. this:
import akka.actor.{ props, deploy, address, addressfromuristring } import akka.remote.remotescope val address = address("akka.tcp", "remotesystem", "1.2.3.4", 1234) val ref = system.actorof(props[myactor]. withdeploy(deploy(scope = remotescope(address)))) in above code, instance of myactor deployed on remote node remotesystem@1.2.3.4:1234.
for more info, can consult remoting docs here.
Comments
Post a Comment