akka - Is there a standard way to do `actorFor orElse actorOf`? -


i actorref may have been created. there standard way call context.actorfor and, if didn't return live actorref, call context.actorof? vice versa fine (ie call context.actorof and, if actor exists, call context.actorfor).

first off: get-or-create can work if there 1 entity (otherwise never sure how created when find it). means parent of actor-to-be place put code.

within actor quite straight-forward:

val child =   context.child(name) match {     case none    => context.actorof(props(...), name)     case some(c) => c   } 

please refrain using actorfor, deprecated in akka 2.2 good reason. in case context.child() want more efficiently.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -