Javatpoint Logo
Javatpoint Logo

Akka ActorSystem

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.

Akka ActorSystem Components

Akka ActorSystem Components

1) Dead Letter Office

Messages which cannot be delivered will be delivered to an actor called deadLetters. Messages sent via unreliable network will be lost without forwarding to dead letter office. The main use of this facility is for debugging purpose, especially if a message sent by an actor does not arrive consistently. You can implement this by importing package.

2) User Guardian Actor

It is parent actor of actors created by user by using ActorSystem. This special guardian is used to achieve an orderly shut-down sequence where logging remains active while all normal actors terminated. It monitors all user created actors.

3) System Guardian Actor

This actor works same as user guardian actor except that it works for system actors. The system guardian monitors the user guardian and initiate its own shut-down upon reception of the Terminated message.

4) Scheduler

Scheduler is a trait and extends to AnyRef. It is used to handle scheduled tasks. It provides the facility to schedule messages. You can schedule sending of messages and execution of tasks. It creates new instance for each ActorSystem for scheduling tasks to happen at specific time.

It returns a cancellable reference so that you can cancel the execution of the scheduled operation by calling cancel method on this reference object.

You can implement Scheduler by importing package.

5) Event System

The Event System also known as eventStream is a main event bus for each ActorSystem. It is used to carry log messages and dead latters. You can also used it to publish messages across entire ActorSystem. You can get eventStream reference by calling actorSystemRef.eventStream() method.

6) Configuration

ActorSystem provides a configuration component which is used to configure application. You can access it from your actor system.

Next TopicAkka Props

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA