I have business objects tree which i receive from from datasource.
Each element of tree is node<T> where T is business object type, on the
same level of tree T-types are same.
Then i traverse the tree for warm up/build actor system, pass to actor
constructor business object T and list of children - List<Node<U>> for
creating child actors.
Its like cascade initialization.
When the *Actor *received *msg *:
1. it modify *Actor *business object state
2. depends on object state, *Actor* sends msg to *CommanderActor* wich call
business command.
3. then *Actor* have to route msg to one concrete child actor.
4. Then the same steps from *1* to *3* are executed for child actor and so
one.
четверг, 19 октября 2017 г., 15:48:30 UTC+3 пользователь Hsnamed написал:
>
> 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.