Book Image

Scala for Java Developers

By : Thomas Alexandre
Book Image

Scala for Java Developers

By: Thomas Alexandre

Overview of this book

Table of Contents (19 chapters)
Scala for Java Developers
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Playing with Actor Room


In the previous section, we have seen a number of projects that are using Enumerators/Iteratees to send and receive messages reactively, with various levels of complexity. Iteratees are powerful, but using them can sometimes lead to code snippets that are not easy to understand. The Play Actor Room project, which is available at https://github.com/mandubian/play-actor-room, proposes to reduce some of the complexity of setting up Iteratees by abstracting away this part and letting the programmer focus only on the domain logic, such as processing incoming messages and assembling outgoing messages. This project started from the observation that many applications need the same functionality, which can be seen as a server Room (holding state, for instance, and being the middle man between distributed clients). The role of this room is to listen for incoming messages from connected clients, and either broadcast received messages after processing them or just unicast communication...