Gene-actors project is one of the core parts of Genes App.
It includes actor system that is intended to serves all async communication between users
(collaborative editing, chatting, webrtc routing etc.) of Genes App.
Is also includes business logic that deals with messages, tasks, video routing, search lookups etc.
As it follows from the name Gene-actors are based on Akka actors that run in an async mode.
If you do not know anything about Akka and actors I advice you to look at http://akka.io/ and read about basic concepts.
Gene-actors currently consist of four main packages: org.denigma.actors, org.denigma.genes, org.denigma.quests, org.denigma.video
org.denigma.actors is the basic one from which all others inherit.
The structures of those packaged are very similar, it contains:
* main actor
* member actors
* workers
* models and messages
* managers
Main actor
Main actor is the actor that supervises (in akka terminology) and contains all other actors inside.
It does:
- establishes the connection
- creates and supervises (in akka's meaning of this term) member actors
- routes messages between actors (for instance with tellAll it broadcast chat messages and tasks to all members)
- subscribes members and other actors to events with a help of MessageBus object
It contains:
- members map where all member actors (see later) are stored as well as rooms
- different worker actors that are responsible for different parts of the functionality
Member actors
For each user the member actor is created. Member actor is responsible for getting user input, processing it, and sending the results back to the user.
Each member actor contain a channel to push messages to the user and parse methods to parse JSON that he receives.
Member actors usually are just an assembly from traits (that I call managers) they inherit from.
Usually they simply concatinate receive and parse partial functions of their traits.
Most of the time you work with that traits, "Member" classes is just a way to compose several traits together.
Comment on This Data Unit