Blog Post

Akka.NET PoisonPill way to stop actors

Tuesday, February 14, 2017 2:28 PM

I am learning about actor framework. While working on the basic I thought I will share couple points.

Poison pill

 I like of to think about Matrix, when using this. You will take Red or Blue pill. There is no way back.

 

My small example is:

 

Creating an actor follows the usual pattern

Now lets take it apart

At first we need to register the actor with the system

 IActorRef actorRef = BulkProcessingSystem.ActorOf(demoActorRef, "DemoActor");

Now we can send a message to illustrate the behaviour, and our actor should receive it.

Now we can send the PoisonPill 

 actorRef.Tell(PoisonPill.Instance);

 

 

If you want to send another message to the same actor with the same reference, the message will be undelivered.

 

To read more about the the stopping actors here: http://getakka.net/docs/working-with-actors/stopping-actors

 

Blog
Products
Error pages
Links and tools