What is actor system in Akka?

What is actor system in Akka?

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. ActorSystem provides an actorOf() method which is used to create actor instance.

How do you stop Akka actor?

In Akka, you can stop Actors by invoking the stop() method of either ActorContext or ActorSystem class. ActorContext is used to stop child actor and ActorSystem is used to stop top level Actor. The actual termination of the actor is performed asynchronously.

How do I stop being an actor?

In short, there are three ways to stop an actor: Stop() the actor: stops the actor immediately after it finishes processing the current message. Kill the actor: this throws an ActorKilledException which will be logged and handled. The actor will stop immediately after it finishes processing the current message.

Can an Akka actor stop itself?

Stopping Actors An actor can stop itself by returning Behaviors. stopped as the next behavior. A child actor can be forced to stop after it finishes processing its current message by using the stop method of the ActorContext from the parent actor.

What kind of API does Akka actors use?

The API of Akka’s Actors is similar to Scala Actors which has borrowed some of its syntax from Erlang.

Is the actorref always the same in Akka?

An ActorRef always represents an incarnation (path and UID) not just a given path. Therefore if an actor is stopped and a new one with the same name is created an ActorRef of the old incarnation will not point to the new one.

Where does akka.actor.unhandledmessage get published to?

Otherwise an akka.actor.UnhandledMessage (message, sender, recipient) will be published to the ActorSystem ‘s EventStream. Note further that the return type of the behavior defined above is Unit; if the actor shall reply to the received message then this must be done explicitly as explained below.

Do you have to be an actor for Akka?

Since Akka enforces parental supervision every actor is supervised and (potentially) the supervisor of its children, it is advisable that you familiarize yourself with Actor Systems and Supervision and Monitoring and it may also help to read Actor References, Paths and Addresses.