protected async Task Handle(StartSystemCommand startFromConfigCommand) { var configPath = startFromConfigCommand.Configuration; if (!File.Exists(configPath)) { throw new ConfigurationException($"Configuration file not found at {configPath}"); } var rawConfig = File.ReadAllText(configPath); var result = JsonConvert.DeserializeObject <HomeCenterConfigDTO>(rawConfig); await LoadCalendars().ConfigureAwait(false); LoadDynamicAdapters(startFromConfigCommand.AdapterMode); ResolveTemplates(result); ResolveInlineAdapters(result); ResolveAttachedProperties(result); CheckForDuplicateUid(result); var types = RegisterTypesInAutomapper(startFromConfigCommand.AdapterMode); _services = CreataActors <ServiceDTO, Service>(result.HomeCenter.Services, types[typeof(ServiceDTO)]); _adapters = CreataActors <AdapterDTO, Adapter>(result.HomeCenter.Adapters, types[typeof(AdapterDTO)]); _components = MapComponents(result); var areas = MapAreas(result, _components); await MessageBroker.Publish(SystemStartedEvent.Default).ConfigureAwait(false); }
protected async Task Handle(StartSystemCommand startFromConfigCommand) { var configPath = startFromConfigCommand.Configuration; if (!File.Exists(configPath)) { throw new ConfigurationException($"Configuration file not found at {configPath}"); } var rawConfig = File.ReadAllText(configPath); var result = JsonConvert.DeserializeObject <HomeCenterConfigDTO>(rawConfig); await LoadTypes(); ResolveTemplates(result); ResolveAttachedProperties(result); CheckForDuplicateUid(result); await LoadActors(result); await MessageBroker.Publish(SystemStartedEvent.Default); }
private void StartSystemFromConfiguration(IContext context) { _configService = _actorFactory.CreateActor <ConfigurationService>(parent: context); MessageBroker.Send(StartSystemCommand.Create(_startupConfiguration.ConfigurationLocation), _configService); }