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); })); }
public MainWindowModel() { var master = SharmComunicator.MasterIpcReady(Id); Mode = !master ? "Server" : "Client"; _ipc = new IpcConnection(master, master ? IpcApplicationType.Client : IpcApplicationType.Server, ErrorHandler); _ipc.Start(); var handler = _ipc.OnMessage <TestMessage>(); handler.OnError().Subscribe(e => ErrorHandler("Serialization", e)); handler.OnResult().Subscribe(InputHandler); Input = new ObservableCollection <string>(); Output = new ObservableCollection <string>(); NewProcess = new SimpleCommand(StartNew); Send = new SimpleCommand(() => Task.Run(SendData)); }