Hi. I have a common problem to solve with actors, and totally unsatisfied with what I invented.
- I have an actor that represents state. - For some message, I have to call a long-running job, e.g. webservice, that will change actor's state; represented as some Future[_]. - Whilst the job is running, the actor shall not process any messages to avoid conflicts. - When job is done, all messages should be processed in order. What is the best way to stop processing of messages in actor until the future resolves? I use stashing with either context.become or FSM, but it's very error prone. I find myself writing almost the same code for locking and unlocking actor, and then noticing some paths when actor is locked and not unlocked on failure, or unlocked when not locked, or locked twice, or lost it's previous state for context.unbecome, etc. But all I really need is just to stop processing messages when the future is being resolved, without boilerplate. Is there anyone solving the same kind of problem? What is the better approach to it? Should I dig into context.dispatcher or actor mailboxes? Or am I wrong minded at all? Thanks! -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
