Hello, i trying to build actor system as N-levels tree with mutable
state/data .
public class RootActor extends AbstractActor implements Loggable {
String name;
Root data;
public static Props props(String name, Root data, List<Node<?>> children) {
return Props.create(RootActor.class, () -> new RootActor(name, data,
children));
}
public RootActor(String name, Root data, List<Node<?>> childs) {
this.name = name;
this.data = data;
spreadChilds(childs);
}
@Override
public Receive createReceive() {
return receiveBuilder().build();
}
private void spreadChilds(List<Node<?>> childs) {
childs.forEach( node -> {
Data obj = ((Node<Data>)node).getData();
List<Node<?>> grandchilds = node.getChildren();
getContext().actorOf(ChildActor.props(obj.getName(), obj,
grandchilds), obj.getName());
});
}
}
1. What is the right way to initialize list of child actors and
grandchildren , does the supervisor strategy helps me to know when actor
tree initialization completed ?
2. Do i need to store child actors references in their parents ?
3. Are there right ways to initialize actors with mutable state/values ?
Thank you for advices.
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.