Last active
March 7, 2017 07:45
-
-
Save cpoDesign/2681315f6910008cd39834a2e4cf6716 to your computer and use it in GitHub Desktop.
Example of actor system register with application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ActorSystemRefs | |
{ | |
public static Akka.Actor.ActorSystem ActorSystem; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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