0

Im Just getting started with actor pattern. Coming from UnitOfWork pattern. Lets say i want to create Actor Pattern for a Employee Management System to mark they are present or absent.

The Problem Im facing is

Should I Create a class Say EmployeesActor instantiate it and use it as a single actor to manage all the employees. So then the messages will specify which particular employee to be marked present.

OR

Should i create a base class EmployeeActor and then create objects of this class for each employee in the System. This was messages would directly go to the object of EmployeeActor.

  • You already accepted an answer, so I'll just link to this. It's a sample Actor implementation in C#. It answers your question about whether you need what amounts to a "singleton" (you don't). Actors are always individual instances. – Robert Harvey Jan 16 '17 at 15:56
2

I would suggest you to create something like EmployeesManager. As a Manager this one class particularly does not have a state but will be used to manage other actors that can have state. This will receive all messages. Once Manager receives command that a particular Employee be marked as present , it will get actor referece by providing the ID, similar to a GetByID call in DDD ( assuming you are persisting the same) and do a actor.Tell() to send the Command to the actor reference. (Its been a year since you posted this question. I would love to see a bigger community so newbie like me/us can get more insight)

  • yes is been more than a year. i tried orleans after akka then completely scrapped the idea of an actor based system. no more working on it but will love to be part of the community. as i think actor based systems with a pre- made / open sourced actor management system can go big. – Parv Sharma Jan 16 '17 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.