scala - Akka Actor internal state during shard migration in a cluster -
we using akka sharding distribute our running actors across several nodes. actors persistent , keep internal state in database.
now need add actorref "metrics actor", running on each node. each actor in shard supposed send telemetric data metrics actor - must choose right metrics actor running locally on same node. reason is, metric actor gathers data peer node.
now, thinking create metric actor in main method (which runs on each node):
val mvmetrics : actorref = system.actorof(metricsactor("mv"), "mvmetrics")
and pass reference clustersharding inicialisation part of actors props object:
clustersharding(system).start( typename = shardname, entityprops = myshardactor.props(mvmetrics), settings = clustershardingsettings(system), extractentityid = idextractor, extractshardid = shardresolver)
my question is, happen if such created actors migrate between nodes, e.g. node -> b? can imagine migrated props object on node b remains same on node a, actorref remains same , therefore newly created actor sending metrics data original node a?
thanks
how taking advantage of actorref.path? imagine each node has actor named in way, , actor dynamically find relevant metrics actor using path.
Comments
Post a Comment