I have been developing with Orleans actor implementation. Recently, I saw that we were scheduling a long running job on an actor, which was effectively blocking the actor since it couldn't process the next messages in its mailbox. Fortunately, Orleans provides a solution where a long running task can be scheduled on an external .Net thread and the actor is free to process next messages in the mailbox. Orleans also provides a way for the external .Net thread to send messages to actors. So, after the job was finished, we made the external .Net thread send required messages.
We were viewing this capability of Orleans as an actor being multithreaded. However, the actor model considers actors to be single threaded. Therefore, we were thinking about whether this multithreaded view of actors violates the actor model rules. When we asked this question on the Orleans forum, the response was
it is much better to view external tasks/threads, external services, etc. as external resources with side effects outside of the actor. Actors can call them and they can call actors, but that doesn't make these external resources part of the actor.
Akka is another major implementation of actor model. Hence, I have following questions: -
- Does Akka have any similar feature like Orleans where a long running task can be given to a separate thread while the actor proceeds onto the next message? I found something similar for Akka here, which is further explained here. These links talk about multiple threads in Akka, but I am not sure.
- Does the
existence of external resources that can communicate with actorsor
actor with multiple threadsviolate the principles of the actor model?