Пример #1
0
 private void XNodeEventService_ComponentCreated(Model.Events.Components.ComponentCreatedArgs obj)
 {
     tenantIOService.TryCreateComponentDirectory(obj.Tenant, obj.Product, new Model.App.Components.Component()
     {
         Id = obj.Id, Name = obj.Name, Settings = obj.Settings
     });
     logger.LogInformation($"Component '{obj.Name}' properties at {obj.Tenant}/{obj.Product} created");
 }
Пример #2
0
        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);
                        });
                    });
                });
            }
        }