O'Reilly logo

Actors in Scala by Frank Sommers, Philipp Haller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.2 Processing messages

In addition to the messages, a key abstraction in the chat application is the ChatRoom. ChatRoom's main responsibilities include keeping a session of actively logged-in users, receiving messages from users, and transmitting a user's message to other interested users, as shown in Figure 4.2.

image images/chatRoomObjects90.jpg

Figure 4.2 - Message communication between chat room and users.

Chat room subscribers are managed as private state of a ChatRoom. A ChatRoom modifies that state upon receiving a Subscribe or Unsubscribe message. This illustrates an important concept of actor-based programming: some messages sent to an actor alter the actor's internal ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required