Example #1
0
 public void Start()
 {
     LighthouseApplication.Run(new string[] { }, true);
 }
Example #2
0
 public void Stop()
 {
     LighthouseApplication.Stop();
 }
Example #3
0
        public static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                LighthouseApplication.Run(args);
            }

            ServiceRunner <WindowsServiceWrapper> .Run(config =>
            {
                config.SetName("Lighthouse");
                config.SetDisplayName("Lighthouse");
                config.SetDescription("Performs cluster management across multiple Actor Systems.");

                var name = config.GetDefaultName();
                config.Service(serviceConfig =>
                {
                    serviceConfig.ServiceFactory((extraArguments, controller) =>
                    {
                        return(new WindowsServiceWrapper(controller));
                    });

                    serviceConfig.OnStart((service, extraArguments) =>
                    {
                        Console.WriteLine("Service {0} started", name);
                        service.Start();
                    });

                    serviceConfig.OnStop(service =>
                    {
                        Console.WriteLine("Service {0} stopped", name);
                        service.Stop();
                    });

                    serviceConfig.OnInstall(service =>
                    {
                        Console.WriteLine("Service {0} installed", name);
                    });

                    serviceConfig.OnUnInstall(service =>
                    {
                        Console.WriteLine("Service {0} uninstalled", name);
                    });

                    serviceConfig.OnPause(service =>
                    {
                        Console.WriteLine("Service {0} paused", name);
                    });

                    serviceConfig.OnContinue(service =>
                    {
                        Console.WriteLine("Service {0} continued", name);
                    });

                    serviceConfig.OnShutdown(service =>
                    {
                        Console.WriteLine("Service {0} shutdown", name);
                    });

                    serviceConfig.OnError(e =>
                    {
                        Console.WriteLine("Service {0} errored with exception : {1}", name, e.Message);
                    });
                });
            });
        }