private static IContainer StartHost() { var timeCoordinator = new TimeCoordinator(); var credentialProvider = new CredentialsProvider(); var exchangeClient = new HealthMonitorExchangeClient(ConfigurationManager.AppSettings["HealthMonitoringUrl"], timeCoordinator, credentialProvider); var settings = LoadSettings(exchangeClient); var builder = new ContainerBuilder(); builder.Register(ctx => ContinuousTaskExecutor<MonitorableEndpoint>.StartExecutor(ctx.Resolve<ITimeCoordinator>())).AsImplementedInterfaces().SingleInstance(); builder.RegisterInstance(timeCoordinator).AsSelf().AsImplementedInterfaces(); builder.RegisterAssemblyTypes(typeof(HealthMonitorRegistry).Assembly).AsSelf().AsImplementedInterfaces().SingleInstance(); builder.RegisterInstance(exchangeClient).AsSelf().AsImplementedInterfaces(); builder.RegisterInstance(settings.MonitorSettings).AsImplementedInterfaces(); builder.RegisterInstance(settings.ThrottlingSettings).AsImplementedInterfaces(); builder.RegisterInstance(AppSettingsDataExchangeConfigProvider.ReadConfiguration()); builder.Register(c => new ThrottlingSampler(c.Resolve<HealthSampler>(), c.Resolve<IThrottlingSettings>())).AsImplementedInterfaces(); builder.RegisterInstance<IHealthMonitorRegistry>(new HealthMonitorRegistry(PluginDiscovery<IHealthMonitor>.DiscoverAllInCurrentFolder("*.Monitors.*.dll"))); builder.RegisterType<EndpointMonitor>().AsSelf().AsImplementedInterfaces().SingleInstance(); builder.RegisterType<MonitorDataExchange>().AsSelf().AsImplementedInterfaces().SingleInstance(); var container = builder.Build(); container.Resolve<EndpointMonitor>(); return container; }
private static IContainer StartHost() { var timeCoordinator = new TimeCoordinator(); var credentialProvider = new CredentialsProvider(); var exchangeClient = new HealthMonitorExchangeClient(ConfigurationManager.AppSettings["HealthMonitoringUrl"], timeCoordinator, credentialProvider); var settings = LoadSettings(exchangeClient); var builder = new ContainerBuilder(); builder.Register(ctx => ContinuousTaskExecutor <MonitorableEndpoint> .StartExecutor(ctx.Resolve <ITimeCoordinator>())).AsImplementedInterfaces().SingleInstance(); builder.RegisterInstance(timeCoordinator).AsSelf().AsImplementedInterfaces(); builder.RegisterAssemblyTypes(typeof(HealthMonitorRegistry).Assembly).AsSelf().AsImplementedInterfaces().SingleInstance(); builder.RegisterInstance(exchangeClient).AsSelf().AsImplementedInterfaces(); builder.RegisterInstance(settings.MonitorSettings).AsImplementedInterfaces(); builder.RegisterInstance(settings.ThrottlingSettings).AsImplementedInterfaces(); builder.RegisterInstance(AppSettingsDataExchangeConfigProvider.ReadConfiguration()); builder.Register(c => new ThrottlingSampler(c.Resolve <HealthSampler>(), c.Resolve <IThrottlingSettings>())).AsImplementedInterfaces(); builder.RegisterInstance <IHealthMonitorRegistry>(new HealthMonitorRegistry(PluginDiscovery <IHealthMonitor> .DiscoverAllInCurrentFolder("*.Monitors.*.dll"))); builder.RegisterType <EndpointMonitor>().AsSelf().AsImplementedInterfaces().SingleInstance(); builder.RegisterType <MonitorDataExchange>().AsSelf().AsImplementedInterfaces().SingleInstance(); var container = builder.Build(); container.Resolve <EndpointMonitor>(); return(container); }
private static IContainer StartHost() { var exchangeClient = new HealthMonitorExchangeClient(ConfigurationManager.AppSettings["HealthMonitoringUrl"]); var settings = LoadSettings(exchangeClient); var builder = new ContainerBuilder(); builder.RegisterAssemblyTypes(typeof(HealthMonitorRegistry).Assembly).AsSelf().AsImplementedInterfaces().SingleInstance(); builder.RegisterInstance(exchangeClient).AsSelf().AsImplementedInterfaces(); builder.RegisterInstance(settings.MonitorSettings).AsImplementedInterfaces(); builder.RegisterInstance(settings.ThrottlingSettings).AsImplementedInterfaces(); builder.RegisterInstance(AppSettingsDataExchangeConfigProvider.ReadConfiguration()); builder.Register(c => new ThrottlingSampler(c.Resolve <HealthSampler>(), c.Resolve <IThrottlingSettings>())).AsImplementedInterfaces(); builder.RegisterInstance <IHealthMonitorRegistry>(new HealthMonitorRegistry(MonitorDiscovery.DiscoverAllInCurrentFolder())); builder.RegisterType <EndpointMonitor>().AsSelf().AsImplementedInterfaces().SingleInstance(); builder.RegisterType <MonitorDataExchange>().AsSelf().AsImplementedInterfaces().SingleInstance(); var container = builder.Build(); container.Resolve <EndpointMonitor>(); return(container); }