Suriyanto,

You switch to pulling in work instead of pushing in work.


On Wed, Mar 5, 2014 at 4:52 PM, Suriyanto Lee <[email protected]> wrote:

> Viktor,
>
> Thanks for the reply. It makes sense and it will simulate Cancel message.
>
> Do you have suggestion on how to do this when the message queue have more
> than 1 messages? In my case, the message queue can have multiple processing
> messages, so the Cancel message could be at the end of the queue still and
> I shouldn't process the next message before the original message is
> completely processed.
>
> Does this mean that I should change my queue to priority queue that will
> give priority to Cancel message?
>
> Thanks,
> Suriyanto
>
>
> On Wednesday, March 5, 2014 2:03:57 AM UTC-8, √ wrote:
>
>> 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.
>



-- 
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.

Reply via email to