Actor Hierarchy

Posted on Posted in Architect, Java

Akka Architecture by default supports parent-child Actor structures. On startup Akka already creates several actors for you:

  • Root guardian – to handle all the actors
  • System guardian – Akka System guardian
  • User guardian – user in this case is you, user guardian manages all the actors created by the developer.
  • Usually you can only create Actors under /user guardian, and then you can further nest by creating actors under your actors.

To further the previous example, our DemoActor now has a ChildDemoActor. Actor Principle is retained here ChildDemoActor tell command is non blocking, so should you have complex things to do parent actor, child actor is also concurrently doing it’s own thing.

Also the value here is, Parent manages the child actors, should the parent actor be terminated, it will terminate all its child actors first. this helps manages actors more efficiently.

Leave a Reply