public static IApplicationBuilder StartNode(string[] args, KillRecpientType type) { //Assemblys.WireUp(); return(ActorApplication.Create(args) .ConfigureAutoFac(cb => { cb.RegisterType <ConsoleAppRoute>().Named <IAppRoute>("default"); cb.RegisterType <KillHelper>().As <IStartUpAction>(); }) .ConfigurateNode() .ConfigureLogging((context, configuration) => { Console.Title = context.HostEnvironment.ApplicationName; configuration.WriteTo.ColoredConsole(); }) .ConfigurateAkkaSystem((context, system) => { if (type == KillRecpientType.Seed) { KillSwitch.Setup(system); } else { KillSwitch.Subscribe(system, type); } })); }
public static IHostBuilder StartNode(this IHostBuilder builder, KillRecpientType type, IpcApplicationType ipcType, Action <IActorApplicationBuilder>?build = null, bool consoleLog = false) { var masterReady = false; if (ipcType != IpcApplicationType.NoIpc) { masterReady = SharmComunicator.MasterIpcReady(IpcName); } var ipc = new IpcConnection(masterReady, ipcType, (s, exception) => LogManager.GetCurrentClassLogger().Error(exception, "Ipc Error: {Info}", s)); return(builder.ConfigureLogging((context, configuration) => { System.Console.Title = context.HostingEnvironment.ApplicationName; if (consoleLog) { configuration.AddConsole(); } }) .ConfigurateNode(ab => { ab.ConfigureAutoFac(cb => { cb.RegisterType <NodeAppService>().As <IHostedService>(); cb.RegisterType <KillHelper>().As <IStartUpAction>(); cb.RegisterInstance(ipc).As <IIpcConnection>(); }) .ConfigureAkkaSystem((_, system) => { switch (type) { case KillRecpientType.Seed: KillSwitch.Setup(system); break; default: KillSwitch.Subscribe(system, type); break; } }); build?.Invoke(ab); })); }