Skip to content

Instantly share code, notes, and snippets.

@cpoDesign
Created April 6, 2017 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpoDesign/0a5e33f21e18d585574a2125818ab83e to your computer and use it in GitHub Desktop.
Save cpoDesign/0a5e33f21e18d585574a2125818ab83e to your computer and use it in GitHub Desktop.
Akka.NET PoisonPill
// The fact that user actor is created using the props does not mean
// anything as it needs to be registered with the system to know about it.
Props demoActorRef = Props.Create<MyDemoActor>();
// Lets register the actor with the system
IActorRef actorRef = BulkProcessingSystem.ActorOf(demoActorRef, "DemoActor");
// Send message to the actor
actorRef.Tell("Akka.net rocks");
// Step to kill the instance of the actor
actorRef.Tell(PoisonPill.Instance);
// Attempt to send message again => message will be undelivered unless something will pick it up
actorRef.Tell("Akka.net rocks after pill");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment