These are chat archives for petabridge/akka-bootcamp

Jul 2015
Igor Ziselman
Jul 07 2015 15:02
If I want to implement "Cancel" for a actor, how can I send to the actor CancellationToken? or suggested other way?
Arjen Smits
Jul 07 2015 16:14
@constructor-igor Do you want to stop the actor? Or do you want a functional stop. ? Because afaik there is no way to forcibly stop an actor when its in the middle of doing something. Otherwise, normal stopping features apply:
Andrew Skotzko
Jul 07 2015 16:55
@constructor-igor sounds like you mean a cancel able scheduled message. See System.Scheduler.ScheduleTellOnceCancelable
Also a tell repeatedly version
Igor Ziselman
Jul 07 2015 20:13
@Danthar @skotzko I want to implement functional "stop": I mean, a actor execute business logic and I want to implement correct way to stop the execution. For example, message to actor contains CancellationToken and the CancellationToken transfered to business logic. When a client wants to stop it can done by CancellationToken. But a problem in immutable of message. If CancellationToken is part of message, client should not change state.
Roger Johansson
Jul 07 2015 20:21
if you have an actor that handles your business logic using some async api, this actor can in itself hold a ref to a cancellation token, that you pass into the api.. and other actors can pass messages to this actor which then calls cancel on the token.
w/o passing the token itself around
Igor Ziselman
Jul 07 2015 20:27
actor cannot process new "cancel" message till end of "business logic" execution. How can other actor pass "cancel" message?
Aaron Stannard
Jul 07 2015 21:35
@constructor-igor so in your case, the business logic is itself a long-running task?
and it blocks inside the body of the actor?