top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are the major advantages of Actor Model in Scala?

+2 votes
319 views
What are the major advantages of Actor Model in Scala?
posted Aug 1, 2016 by Dominic

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

So let’s start from the very beginning! An Actor in the Actor Model is comprised by 3 distinct pieces:

A behavior

An address

A mailbox

The Address is the thing you send messages to, they are then put into the Mailbox and the Behavior is applied to the messages in the mailbox—one at a time. Since only one message is processed at a time, you can view an Actor as an island of consistency, connected to other actors via their Addresses and by sending and receiving messages from them.

There are 3 core operations that an Actor needs to support in order for it to qualify as an Actor.

CREATE—an Actor has to be able to create new Actors

SEND—an Actor needs to be able to send messages to Actors

BECOME—an Actor needs to be able to change its behavior for the next message

Since what you send messages to is an Address, there is an indirection which allows the Mailbox and Behavior to live essentially anywhere, as long as the message can get routed there. This is also referred to as Location Transparency

answer Aug 30, 2016 by Karthick.c
...