private void XNodeEventService_StorageConnected(Model.Events.Agents.AgentConnectedArgs obj) { logger.LogInformation($"Agent '{obj.Agent}' with id '{obj.AgentId}' is connected"); foreach (var tenant in obj.Tenants) { logger.LogInformation($"Agent '{obj.AgentId}' is connected to '{tenant.Key}' tenant"); // Trying to create new tenants locations in the storage. tenantIOService.TryCreateTenantDirectory(tenant.Key, tenant.Value); tenantIOService.WriteAgentStateInTenantLog(tenant.Key, obj.AgentId.ToString(), "connected"); tenant.Value.Products.ToList().ForEach(product => { tenantIOService.TryCreateProductDirectory(tenant.Key, product.Value); product.Value.Components.ToList().ForEach(component => { tenantIOService.TryCreateComponentDirectory(tenant.Key, product.Key, component.Value); component.Value.Topics.ToList().ForEach(topic => { tenantIOService.TryCreateTopicDirectory(tenant.Key, product.Key, component.Key, topic.Value); }); }); }); } }
private void XNodeEventService_TenantCreated(Model.Events.Tenants.TenantCreatedArgs obj) { tenantIOService.TryCreateTenantDirectory(obj.Name, new Model.App.Tenants.Tenant() { Id = obj.Id, Name = obj.Name, Settings = obj.Settings }); logger.LogInformation($"Tenant '{obj.Name}' properties created"); }