public void Start() { SystemActors.ClusterSystem = SystemHostFactory.Launch(); // Create and build the container var container = new Ninject.StandardKernel(); container.Bind <IFileProcessorRepository>().To(typeof(FileProcessorRepository)).InTransientScope(); container.Bind <DistributedPubSub>().ToConstant(DistributedPubSub.Get(SystemActors.ClusterSystem)); // Create the dependency resolver for the actor system IDependencyResolver resolver = new NinjectDependencyResolver(container, SystemActors.ClusterSystem); var pbm = PetabridgeCmd.Get(SystemActors.ClusterSystem); pbm.RegisterCommandPalette(ClusterCommands.Instance); // enable cluster management commands pbm.Start(); SystemActors.SettingsWatcherRef = SystemActors.ClusterSystem.ActorOf(SystemActors.ClusterSystem.DI().Props <DatabaseWatcherActor>(), "DatabaseWatcher"); SystemActors.Mediator = DistributedPubSub.Get(SystemActors.ClusterSystem).Mediator; SystemActors.LocationManagerActorRef = SystemActors.ClusterSystem.ActorOf(ClusterSingletonManager.Props( singletonProps: Props.Create(() => new LocationManagerActor()), // Props used to create actor singleton terminationMessage: PoisonPill.Instance, // message used to stop actor gracefully settings: ClusterSingletonManagerSettings.Create(SystemActors.ClusterSystem).WithRole(StaticMethods.GetServiceWorkerRole())), // cluster singleton manager settings name: ActorPaths.SingletonManagerActor.Name); SystemActors.LocationManagerProxyRef = SystemActors.ClusterSystem.ActorOf(ClusterSingletonProxy.Props( singletonManagerPath: ActorPaths.SingletonManagerActor.Path, settings: ClusterSingletonProxySettings.Create(SystemActors.ClusterSystem).WithRole(StaticMethods.GetServiceWorkerRole())), name: ActorPaths.SingletonManagerProxy.Name); }
public void Start() { SystemActors.ClusterSystem = SystemHostFactory.Launch(); // Create and build the container var container = new Ninject.StandardKernel(); container.Bind <IFileProcessorRepository>().To(typeof(FileProcessorRepository)).InTransientScope(); // Create the dependency resolver for the actor system IDependencyResolver resolver = new NinjectDependencyResolver(container, SystemActors.ClusterSystem); var pbm = PetabridgeCmd.Get(SystemActors.ClusterSystem); pbm.RegisterCommandPalette(ClusterCommands.Instance); // enable cluster management commands pbm.Start(); SystemActors.Mediator = DistributedPubSub.Get(SystemActors.ClusterSystem).Mediator; }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { try { SystemActors.ClusterSystem = SystemHostFactory.Launch(); var pbm = PetabridgeCmd.Get(SystemActors.ClusterSystem); pbm.RegisterCommandPalette(ClusterCommands.Instance); // enable cluster management commands pbm.Start(); SystemActors.Mediator = DistributedPubSub.Get(SystemActors.ClusterSystem).Mediator; SystemActors.SignalRActor = SystemActors.ClusterSystem.ActorOf(Props.Create(() => new SignalRActor()), "StatusActor"); } catch (Exception e) { Console.WriteLine(e); throw; } services.AddSignalR(); services.AddSingleton <StatusHubHelper, StatusHubHelper>(); services.AddSingleton <InjectedActorProvider>(provider => { var injectedActor = SystemActors.ClusterSystem.ActorOf(Props.Create(() => new SignalRActor()), "SignalR"); provider.GetService <StatusHubHelper>().StartSignalR(injectedActor); return(() => injectedActor); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.Configure <ApiBehaviorOptions>(options => { //options.SuppressModelStateInvalidFilter = true; }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseFileServer(); app.UseSignalR(routes => { routes.MapHub <StatusHub>("/statusHub"); }); try { SystemActors.ClusterSystem = SystemHostFactory.Launch(); var pbm = PetabridgeCmd.Get(SystemActors.ClusterSystem); pbm.RegisterCommandPalette(ClusterCommands.Instance); // enable cluster management commands pbm.Start(); SystemActors.Mediator = DistributedPubSub.Get(SystemActors.ClusterSystem).Mediator; SystemActors.SignalRActor = SystemActors.ClusterSystem.ActorOf(Props.Create(() => new SignalRActor()), "StatusActor"); app.ApplicationServices.GetService <StatusHubHelper>().StartAsync(CancellationToken.None); //start Akka.NET } catch (Exception e) { Console.WriteLine(e); throw; } }
public void InitializeCluster() { SystemActors.ClusterSystem = SystemHostFactory.Launch(); loggerBox.Items.Insert(0, string.Format("{0} {1}", DateTime.Now.ToString("MM-dd-yy hh:mm:ss.fff"), "Actor System Started")); InitializeActors(); }