A technique I prefer is the following:
case object Continue
case object Cancel
class Worker extends Actor {
def receive = {
case Continue =>
doSmallChunkOfWork()
self forward Continue
case Cancel => context stop self
}
}
On Wed, Mar 5, 2014 at 1:12 AM, Suriyanto Lee <[email protected]> wrote:
> Hello,
>
> We have an Akka actor system running where some actors can process a short
> message (<10 secs) and some actors could take up to 20 minutes. At times,
> users might decide to cancel the process.
>
> We originally implement calling Stop on the actor, but it caused too much
> lag for user when long message are being processed. Afterwards we modified
> the actor so that it will perform periodic checks for a cancel flag. The
> second implementation makes the cancellation to be more responsive, but
> does not scale well as the number of actors increased.
>
> What is the pattern or best practice in Akka for this case? Is there a way
> to broadcast an interrupt message to actors for cancelation?
>
> Thanks,
> Suriyanto
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
> >>>>>>>>>> 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/groups/opt_out.
>
--
Cheers,
√
*———————**Viktor Klang*
*Chief Architect - **Typesafe <http://www.typesafe.com/>*
Twitter: @viktorklang
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> 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/groups/opt_out.