I'm trying to pass on certain information about a hierarchy of actors so that's available when they receive messages. For example, I have one actor chain per user and I would like to make available the user information (name) across all children of that actor.
At the moment I'm trying to access the user actor from any children in the hierarchy to get the name but a) I don't know if that's a good practice and b) A simply don't know if I can achieve that when I have more than one level in the hierarchy and the user name is obviously dynamic.
So I've tried this (assume I want to access the parent's parent)
var name = Context.ActorSelection("../..").Path.Name;
That doesn't return anything useful and doesn't seem to go up two levels in the hierarchy.
The other option I thought was creating the actor hierarchy and construct all the nodes below with Props and passing in the user name and again, I don't know if that's a good practice either/the right thing to do. So for example:
public class MyActor: TypedActor
{
public MyActor(string id)
{
_id = id;
Context.ActorOf(Props.Create<ChildActor>(_id), "childname");
}
}
And so on...