Example #1
0
        public OutageLifecycleService(StatefulServiceContext context)
            : base(context)
        {
            this.baseLogString = $"{this.GetType()} [{this.GetHashCode()}] =>{Environment.NewLine}";
            Logger.LogDebug($"{baseLogString} Ctor => Logger initialized");

            try
            {
                var modelResourcesDesc = new ModelResourcesDesc();
                var lifecycleHelper    = new OutageLifecycleHelper(modelResourcesDesc);

                this.potentialOutageReportingProvider = new PotentialOutageReportingProvider(StateManager, lifecycleHelper);
                this.outageIsolationProvider          = new OutageIsolationProvider(StateManager, lifecycleHelper, modelResourcesDesc);
                this.crewSendingProvider      = new CrewSendingProvider(StateManager, lifecycleHelper);
                this.outageResolutionProvider = new OutageResolutionProvider(StateManager, lifecycleHelper);
                this.notifySubscriberProvider = new NotifySubscriberProvider(StateManager);

                this.isolationAlgorithmCycle = new IsolationAlgorithmCycle(StateManager, lifecycleHelper, isolationAlgorithmCycleInterval, isolationAlgorithmUpperLimit);

                string infoMessage = $"{baseLogString} Ctor => Contract providers initialized.";
                Logger.LogInformation(infoMessage);
                ServiceEventSource.Current.ServiceMessage(this.Context, $"[OMS.OutageLifecycleService | Information] {infoMessage}");
            }
            catch (Exception e)
            {
                string errorMessage = $"{baseLogString} Ctor => Exception caught: {e.Message}.";
                Logger.LogError(errorMessage, e);
                ServiceEventSource.Current.ServiceMessage(this.Context, $"[OMS.OutageLifecycleService | Error] {errorMessage}");
            }
        }
        public OutageSimulatorService(StatefulServiceContext context)
            : base(context)
        {
            this.baseLogString = $"{this.GetType()} [{this.GetHashCode()}] =>{Environment.NewLine}";
            Logger.LogDebug($"{baseLogString} Ctor => Logger initialized");

            try
            {
                this.controlCycle = new SimulationControlCycle(StateManager, commandedValueIntervalUpperLimit);

                this.outageSimulatorProvider   = new OutageSimulatorProvider(StateManager);
                this.outageSimulatorUIProvider = new OutageSimulatorUIProvider(StateManager);
                this.notifySubscriberProvider  = new NotifySubscriberProvider(StateManager, MicroserviceNames.OmsOutageSimulatorService);
            }
            catch (Exception e)
            {
                string errorMessage = $"{baseLogString} Ctor => Exception caught: {e.Message}.";
                Logger.LogError(errorMessage, e);
                ServiceEventSource.Current.ServiceMessage(this.Context, $"[OMS.OutageSimulatorService | Error] {errorMessage}");
            }
        }