Was wondering if I could stop an actor without necessarily waiting for the current message to be processed, or just cancel it.
Here explains the ways of doing it
But they all wait for the current message to be processed.
Stop() the actor:
stops the actor immediately after it finishes
processing the current message.
this throws an ActorKilledException which will be logged and handled. The actor will
stop immediately after it finishes processing the current message.
the actor will finish processing the
messages currently in its mailbox, and then Stop.
I would question why you have a long running process inside the actors message receive. It would be better practice to place any code that may take some time and that you want to be able to cancel into a Task within the receive of the message.
The actor would then be freed up and be able to accept the message from one of the stop methods you list above, and terminate the task accordingly.
Additionally, point 4 on the following page shows some example code https://petabridge.com/blog/top-7-akkadotnet-stumbling-blocks/