Top Spring Security Interview Questions (2020) | CodeUsingJava








Most frequently asked Akka Interview Questions



What is Akka framework?

  • Akka is a free and open-source toolkit and runtime simplifying the construction of concurrent and distributed applications on the JVM. Akka supports multiple programming models for concurrency, but it emphasizes actor-based concurrency, with inspiration drawn from Erlang.
    One can integrate this library into any JVM(Java Virtual Machine) support language. It implements Actor Based Model. The Actor Model provides a higher level of abstraction for writing concurrent and distributed applications.


What is an Actor in Akka?

An actor is an entity which communicates to other actor by message passing. Actor has it's own state and behavior. As in object-oriented programming everything is an object same like everything is an actor in actor-based system. In other words, we can say that an actor is an object that encapsulates state and behavior.

What is an ActorSystem in Akka?

The ActorSystem is a root actor in actors structure. An ActorSystem is a hierarchical group of actors which share common configuration, e.g. dispatchers, deployments, remote capabilities and addresses. It is also the entry point for creating or looking up actors. It is an abstract class which extends to ActorRefFactory trait. ActorSystem provides an actorOf() method which is used to create actor instance.

Define lifecycle for Akka actor?

The lifecycle of Akka actor is as follows-
  • preStart()
  • postStop()
  • preRestart(reason: Throwable, message: Option[Any])
  • postRestart(reason: Throwable)

What is the difference between Akka Kill vs Stop vs Poison Pill?

Both stop and PoisonPill will terminate the actor and stop the message queue. They will cause the actor to cease processing messages, send a stop call to all its children, wait for them to terminate, then call its postStop hook. All further messages are sent to the dead letters mailbox. By contrast, the Kill message causes the actor to throw an ActorKilledException which gets handled using the normal supervisor mechanism.