private void ConfigureActorSystem(Config config) { DemoActorSystem = ActorSystem.Create("demoSystem", config); DemoSystemSupervisor = DemoActorSystem.ActorOf(Props.Create <SystemSupervisor>(), "demoSupervisor"); var statsDServer = config.GetString("Akka.StatsDServer"); var statsDPort = Convert.ToInt32(config.GetString("Akka.StatsDPort")); var statsDPrefix = config.GetString("Akka.StatsDPrefix"); BusinessRulesFilename = config.GetString("Akka.BusinessRulesFilename"); CommandsToRulesFilename = config.GetString("Akka.CommandsToRulesFilename"); Console.WriteLine($"(StatsD) Server: {statsDServer}"); Console.WriteLine($"(StatsD) Port: {statsDPort}"); Console.WriteLine($"(StatsD) Prefix: {statsDPrefix}"); ActorMonitoringExtension.RegisterMonitor(DemoActorSystem, new ActorStatsDMonitor(statsDServer , statsDPort , statsDPrefix )); DemoSystemSupervisor.Tell(new BootUp("Starting Up")); Console.WriteLine($"(Business Rules) BusinessRulesFilename: {BusinessRulesFilename}"); Console.WriteLine($"(Business Rules) CommandsToRulesFilename: {CommandsToRulesFilename}"); AccountBusinessRulesMapperRouter = DemoActorSystem.ActorOf(Props.Create <AccountBusinessRulesMapper>(), "AccountBusinessRulesMapperRouter"); AccountBusinessRulesMapperRouter.Tell(new BootUp("Get up!")); Console.WriteLine($"(Business Rules) AccountBusinessRulesMapperRouter spun up"); AccountBusinessRulesHandlerRouter = DemoActorSystem.ActorOf(Props.Create <AccountBusinessRulesHandler>(), "AccountBusinessRulesHandlerRouter"); AccountBusinessRulesHandlerRouter.Tell(new BootUp("Get up!")); Console.WriteLine($"(Business Rules) AccountBusinessRulesHandlerRouter spun up"); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = true, ReactHotModuleReplacement = true }); } else { app.UseExceptionHandler("/Home/Error"); } app.UseSignalR(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapSpaFallbackRoute( name: "spa-fallback", defaults: new { controller = "Home", action = "Index" }); }); Func <IHubContextAccessor> getHubContextAccessor = () => app.ApplicationServices.GetService <IHubContextAccessor>(); DemoActorSystem.Create(getHubContextAccessor); }
private void OnShutdown() { DemoActorSystem.Shutdown(); }