Skip to content

Instantly share code, notes, and snippets.

@cpoDesign
Last active March 7, 2017 07:45
Show Gist options
  • Save cpoDesign/2681315f6910008cd39834a2e4cf6716 to your computer and use it in GitHub Desktop.
Save cpoDesign/2681315f6910008cd39834a2e4cf6716 to your computer and use it in GitHub Desktop.
Example of actor system register with application
public class ActorSystemRefs
{
public static Akka.Actor.ActorSystem ActorSystem;
}
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
//...routing and bundling etc
// setup akka system
ActorSystemRefs.ActorSystem = Akka.Actor.ActorSystem.Create("myactorsystem");
SystemActors.ExampleActorRef = ActorSystemRefs.ActorSystem.ActorOf(Props.Create(() => new ExampleActor()), "exampleActor");
}
protected async void Application_End()
{
await ActorSystemRefs.ActorSystem.Terminate();
//wait up to two seconds for a clean shutdown
await ActorSystemRefs.ActorSystem.WhenTerminated;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment