コード例 #1
0
ファイル: Program.cs プロジェクト: barbatron/converge
        public static void Main()
        {
            Log4NetLogger.Use(@"D:\code\net\Converge\log4net.xml");

            var transportSettings = TransportSettings.UseRabbitMq("localhost");
            var container = BootstrapContainer(transportSettings, "converge_centralmon");

            var appSubscribers = new CompositeSubscriber();
            //appSubscribers.RegisterSubscribers(container.GetAllInstances<IDisposableSubscriber>());

            // Roll out a service actnig as the primary app grunks
            HostFactory.Run(c =>
            {
                c.SetServiceName("ConvergeCMon");
                c.SetDisplayName("Converge Central monitor");
                c.SetDescription("Converge node activity monitor.");

                c.RunAsLocalSystem();

                Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));

                c.Service<MonitorService>(s =>
                {
                    s.ConstructUsing(builder => container.GetInstance<MonitorService>());
                    s.WhenStarted(o => o.Start());
                    s.WhenStopped(o => o.Stop());
                });

            });
        }
コード例 #2
0
ファイル: MonitorService.cs プロジェクト: barbatron/converge
 public MonitorService(IServiceBus bus, CompositeSubscriber subscribers)
 {
     this.bus = bus;
     this.subscribers = subscribers;
 }