Search code examples
akkaactor

How reliable is akka actor


As akka is a toolkit to build actor models, which are objects running inside JVM, how reliable is the actor object after creation. Keeping the let it crash nature into consideration, how reliable is actor object in JVM unless its explicitly killed like using poison pill or JVM shutdown, does the actor not killed all by itself.

Edit:

Supposing below is the scenario, I have created a custom actor system with name "mysystem" and an two actors created under "/user" A and B where A is supervisor of B.

A <- supervisor actor ( akka://mysystem/user/A ) B <- actor ( akka://mysystem/user/A/B )

After the creation, assuming that I have no intetion of the Posion Pill and JVM is never going to crash, considering these assumptions, does A and B ever gets crashed by itself.


Solution

  • In Akka, there's the concept of "supervision". Every actor has a parent that will supervise its child actors. When an actor fails with an unexpected exception, there's a well-defined life-cycle process that will restart the actor transparently (if configured like this).

    See the chapter about supervision and fault tolerance in the documentation for more information.