예제 #1
0
        public void InitializeHostedService(IServiceConfigurator <InProcessKlingerWebServer> cfg)
        {
            var repo = new EnvironmentValidatorRepository();

            cfg.HowToBuildService(name => new InProcessKlingerWebServer(8008, repo));
            cfg.WhenStarted(s => s.Start());
            cfg.WhenStopped(s => s.Stop());
        }
        public InProcessKlingerScheduleServer(EnvironmentValidatorRepository repository, TimeSpan schedulerDelay,
                                              TimeSpan schedulerInterval)
        {
            EventChannel = new ChannelAdapter();

            _fiber = new PoolFiber();
            _scheduler = new TimerScheduler(_fiber);
            _repository = repository;
            _schedulerDelay = schedulerDelay;
            _schedulerInterval = schedulerInterval;
        }
예제 #3
0
        public static void Configure(Action<KlingerConfiguration> action)
        {
            _repository = new EnvironmentValidatorRepository();

            var b = new BackingConfigurationObject(_repository);
            action(b);

            if (b.ShouldHostWebServerInProcess)
            {
                _webServer = new InProcessKlingerWebServer(b.Port, _repository);
                _webServer.Start();
            }

            if (b.ShouldRunScheduler)
            {
                _scheduleServer = new InProcessKlingerScheduleServer(_repository, b.SchedulerDelay, b.SchedulerInterval);

                _scheduleServer.OnFatal(b.ErrorAction);
                _scheduleServer.OnWarning(b.WarningAction);
                _scheduleServer.Start();
            }
        }
예제 #4
0
        public static void Configure(Action <KlingerConfiguration> action)
        {
            _repository = new EnvironmentValidatorRepository();

            var b = new BackingConfigurationObject(_repository);

            action(b);

            if (b.ShouldHostWebServerInProcess)
            {
                _webServer = new InProcessKlingerWebServer(b.Port, _repository);
                _webServer.Start();
            }

            if (b.ShouldRunScheduler)
            {
                _scheduleServer = new InProcessKlingerScheduleServer(_repository, b.SchedulerDelay, b.SchedulerInterval);

                _scheduleServer.OnFatal(b.ErrorAction);
                _scheduleServer.OnWarning(b.WarningAction);
                _scheduleServer.Start();
            }
        }
예제 #5
0
        public static void RenderSparkView(this ResponseContext cxt, EnvironmentValidatorRepository repo, string template)
        {
            string output = _render.Render("status.html", repo.TakeTemperature(), new KlingerInformation());

            cxt.WriteHtml(output);
        }
 public InProcessKlingerWebServer(int port, EnvironmentValidatorRepository repo)
 {
     _port = port;
     _repo = repo;
 }
 public static void RenderSparkView(this ResponseContext cxt, EnvironmentValidatorRepository repo, string template)
 {
     string output = _render.Render("status.html", repo.TakeTemperature(), new KlingerInformation());
     cxt.WriteHtml(output);
 }
예제 #8
0
 public BackingConfigurationObject(EnvironmentValidatorRepository repository)
 {
     _repository = repository;
 }