The only actor which can “get or create” another actor is its parent, which is 
obvious due to the “create” part. The parent does not gain from using 
ActorSelection, since it can just directly query its children map using 
`context.child(…)`.

The other consideration is that you seem to be using actor hierarchies to 
directly represent the identity of domain entities, which is questionable in 
the sense that the supervision hierarchy is thereby constrained in possibly 
inappropriate ways (meaning that the name of the parent entity needs to outlive 
the child entities by definition, which may or may not be a good idea for the 
model in question).

If you want to address entities by their identity regardless of their location 
or whether they are currently held in memory, you can use the cluster sharding 
extension (which also nicely works with persistent actors).

Regards,

Roland

13 apr 2014 kl. 05:36 skrev Chanan Braunstein <[email protected]>:

> I am playing around with Akka persistence - creating some data and querying 
> it using Play 2.3.
> 
> When I load data in the system, to query the system I use ActorSelection with 
> the path. One I shut down the JVM, the ActorSelection won't work as the Actor 
> hasn't been loaded yet, so I create a new ActorRef.
> 
> My question is, is there a good pattern to get or create an actor? 
> 
> -- 
> >>>>>>>>>> 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 http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to