Exemplo n.º 1
0
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 128;

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            bool result = base.OnStart();

            TelemetryConfiguration.Active.InstrumentationKey = CloudConfigurationManager.GetSetting("APPINSIGHTS_INSTRUMENTATIONKEY");

            // TODO: disable
            // TelemetryConfiguration.Active.TelemetryChannel.DeveloperMode = true;
            this.telemetry = new TelemetryClient();

            this.telemetry.TrackTrace("WorkerRole starting", SeverityLevel.Information);

            try
            {
                this.trainProcesserHost = new LearnEventProcessorHost();
                this.settingsWatcher    = new OnlineTrainerSettingsWatcher(this.trainProcesserHost);

                this.StartRESTAdminEndpoint();
            }
            catch (Exception e)
            {
                this.telemetry.TrackException(e);
                // still start to give AppInsights a chance to log
            }

            return(result);
        }
Exemplo n.º 2
0
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 128;

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            bool result = base.OnStart();

            TelemetryConfiguration.Active.InstrumentationKey = CloudConfigurationManager.GetSetting("APPINSIGHTS_INSTRUMENTATIONKEY");

            // TODO: disable
            // TelemetryConfiguration.Active.TelemetryChannel.DeveloperMode = true;
            this.telemetry = new TelemetryClient();

            this.telemetry.TrackTrace("WorkerRole starting", SeverityLevel.Information);

            try
            {
                this.trainProcesserHost = new LearnEventProcessorHost();
                this.settingsWatcher = new OnlineTrainerSettingsWatcher(this.trainProcesserHost);

                this.StartRESTAdminEndpoint();
            }
            catch (Exception e)
            {
                this.telemetry.TrackException(e);
                // still start to give AppInsights a chance to log
            }

            return result;
        }
Exemplo n.º 3
0
        public override void OnStop()
        {
            this.telemetry.TrackTrace("WorkerRole stopping", SeverityLevel.Information);

            try
            {
                this.stopEvent.Set();

                if (this.settingsWatcher != null)
                {
                    this.settingsWatcher.Dispose();
                    this.settingsWatcher = null;
                }

                if (this.trainProcesserHost != null)
                {
                    this.trainProcesserHost.Dispose();
                    this.trainProcesserHost = null;
                }

                if (this.webApp != null)
                {
                    this.webApp.Dispose();
                    this.webApp = null;
                }

                base.OnStop();
            }
            catch (Exception e)
            {
                this.telemetry.TrackException(e);
            }

            this.telemetry.TrackTrace("WorkerRole stopped", SeverityLevel.Information);
        }
Exemplo n.º 4
0
        public override void OnStop()
        {
            this.telemetry.TrackTrace("WorkerRole stopping", SeverityLevel.Information);

            try
            {
                this.stopEvent.Set();

                if (this.settingsWatcher != null)
                {
                    this.settingsWatcher.Dispose();
                    this.settingsWatcher = null;
                }

                if (this.trainProcesserHost != null)
                {
                    this.trainProcesserHost.Dispose();
                    this.trainProcesserHost = null;
                }

                if (this.webApp != null)
                {
                    this.webApp.Dispose();
                    this.webApp = null;
                }

                base.OnStop();
            }
            catch (Exception e)
            {
                this.telemetry.TrackException(e);
            }

            this.telemetry.TrackTrace("WorkerRole stopped", SeverityLevel.Information);
        }