static void Main(string[] args) { _system = ActorSystem.Create("akka-visualize-demo"); var commandLineVisualizer = new CommandLineVisualizer(); var webVisualizer = new WebApiVisualizer(); ActorVisualizeExtension.InstallVisualizer(_system, commandLineVisualizer); ActorVisualizeExtension.InstallVisualizer(_system, webVisualizer); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Starting up actor system..."); var goodbyPool = _system.ActorOf(Props.Create <GoodbyeActor>().WithRouter(new RandomPool(10)), "GoodbyPool"); var goodbuyGroup = _system.ActorOf(Props.Create <GoodbyeActor>().WithRouter(new RandomGroup("a1", "a2", "a3")), "GoodbyGroup"); var goodbye = _system.ActorOf(Props.Create <GoodbyeActor>(), "Goodby"); var hello = _system.ActorOf <HelloActor>("Hello"); //Console.WriteLine("Incrementing debug log once every 10 ms for 2 seconds..."); //var count = 200; //while (count >= 0) //{ // //ActorMonitoringExtension.Monitors(_system).IncrementDebugsLogged(); // //Console.WriteLine("Logging debug..."); // Thread.Sleep(100); // count--; //} //Console.WriteLine("Starting a conversation between actors"); goodbye.Tell(new Tuple <IActorRef, string>(hello, "Start")); goodbyPool.Tell(new Tuple <IActorRef, string>(hello, "Start")); goodbuyGroup.Tell(new Tuple <IActorRef, string>(hello, "Start")); //goodbye.Tell(new Tuple<IActorRef, string>(hello, "Start")); webVisualizer.Start(); // Start Akka Command LIne commandLineVisualizer.Run(); while (ManualResetEvent.WaitOne()) { Console.WriteLine("Shutting down..."); _system.Shutdown(); Console.WriteLine("Shutdown complete"); Console.WriteLine("Press any key to exit"); Console.ReadKey(); return; } }
public void ConfigureServices(IServiceCollection services) { services.AddCors(); services.AddShardedEntities(x => { /* Register your entities here */ x.WithShardedEntity <HelloEntity, HelloCommand, HelloEvent, HelloState>(); }); services.AddReactiveServices(x => { // Note: these don't really need to be called, they are the default // I've only added them here as an example x.WithTopicSerializer <DefaultSerializer>(); x.WithMessagePropertyExtractor <DefaultExtractor>(); /* Register all the services here */ x.AddReactiveService <HelloService, HelloServiceImpl>(); /* Any additions to the actor system can be done in here */ x.AddActorSystemDelegate(system => { /* This visualizer is a bit of a nice to have, not fully functional yet */ ActorVisualizeExtension.InstallVisualizer(system); }); }, /* * Optionally enable any reactive services options here. * Note, for any console apps you can simply use `None` */ ReactiveServicesOption.WithApi | ReactiveServicesOption.WithSwagger | ReactiveServicesOption.WithTopics | ReactiveServicesOption.WithVisualizer ); }