Ejemplo n.º 1
0
        private void StartAgents(IApplicationLifetime appLifetime)
        {
            // Temporary workaround to allow twin JSON deserialization in IoT SDK
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                CheckAdditionalContent = false
            };

            var config = this.ApplicationContainer.Resolve <IConfig>();

            // Start the partitioning agent, unless disabled
            this.partitioningAgent     = this.ApplicationContainer.Resolve <IPartitioningAgent>();
            this.partitioningAgentTask = config.ServicesConfig.DisablePartitioningAgent
                ? Task.Run(() => Thread.Sleep(TimeSpan.FromHours(1)))
                : this.partitioningAgent.StartAsync(this.appStopToken.Token);

            // Start the simulation agent, unless disabled
            this.simulationAgent     = this.ApplicationContainer.Resolve <ISimulationAgent>();
            this.simulationAgentTask = config.ServicesConfig.DisableSimulationAgent
                ? Task.Run(() => Thread.Sleep(TimeSpan.FromHours(1)))
                : this.simulationAgent.StartAsync(this.appStopToken.Token);

            // This creates sample simulations that will be shown on simulation dashboard by default
            this.simulationService = this.ApplicationContainer.Resolve <ISimulations>();
            if (!config.ServicesConfig.DisableSeedByTemplate)
            {
                this.simulationService.TrySeedAsync();
            }

            this.threadsMonitoringTask = this.MonitorThreadsAsync(appLifetime);
        }
Ejemplo n.º 2
0
        private void StartAgents()
        {
            // Temporary workaround to allow twin JSON deserialization in IoT SDK
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                CheckAdditionalContent = false
            };

            this.partitioningAgent = this.ApplicationContainer.Resolve <IPartitioningAgent>();
            this.partitioningAgent.StartAsync();

            this.simulationAgent = this.ApplicationContainer.Resolve <ISimulationAgent>();
            this.simulationAgent.RunAsync();
        }
Ejemplo n.º 3
0
        private void StartAgents()
        {
            // Temporary workaround to allow twin JSON deserialization in IoT SDK
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                CheckAdditionalContent = false
            };

            this.partitioningAgent = this.ApplicationContainer.Resolve <IPartitioningAgent>();
            this.partitioningAgent.StartAsync();

            this.simulationAgent = this.ApplicationContainer.Resolve <ISimulationAgent>();
            this.simulationAgent.StartAsync();

            // This creates sample simulations that will be shown on simulation dashboard by default
            this.simulationService = this.ApplicationContainer.Resolve <ISimulations>();
            this.simulationService.TrySeedAsync();
        }