Ejemplo n.º 1
0
        public bool SetTagValue(string groupName, string tagName, string value)
        {
            var output = false;

            if (SystemGroups.ContainsKey(groupName))
            {
                output = SystemGroups[groupName].SetTagValue(tagName, value);
            }

            return(output);
        }
Ejemplo n.º 2
0
        public async ValueTask <string> GetTagValueAsync(string groupName, string tagName)
        {
            var output = string.Empty;

            if (SystemGroups.ContainsKey(groupName))
            {
                output = await SystemGroups[groupName].GetTagValueAsync(tagName).ConfigureAwait(false);
            }

            return(output);
        }
Ejemplo n.º 3
0
        public string GetTagValue(string groupName, string tagName)
        {
            var output = string.Empty;

            if (SystemGroups.ContainsKey(groupName))
            {
                output = SystemGroups[groupName].GetTagValue(tagName);
            }

            return(output);
        }
Ejemplo n.º 4
0
        public async ValueTask <bool> SetTagValueAsync(string groupName, string tagName, string value)
        {
            //_logger.LogTrace("SetTagValueAsync: " + groupName + " " + tagName + " " + value);
            var output = false;

            if (SystemGroups.ContainsKey(groupName))
            {
                output = await SystemGroups[groupName].SetTagValueAsync(tagName, value).ConfigureAwait(false);
            }

            return(output);
        }
Ejemplo n.º 5
0
        public void LoadGroup()
        {
            //var result =
            try
            {
                foreach (var tagGroupReady in _tagGroupReady.GetAllTagGroupReady())
                {
                    #region [Connection]

                    TagGroupEventBus.Add(tagGroupReady.Name + "_Connection",
                                         new EventBusRabbitMqRpc(PersistentConnection, _loggerFactory, new ConnectionStatusRpcHandler(_loggerFactory, _componentContext),
                                                                 null, _exchangeDeclareParameters, _queueDeclareParameters, "BusinessQueueConnection_" + tagGroupReady.Name, CancellationToken.None));

                    ((IEventBusRpcClient)TagGroupEventBus[tagGroupReady.Name + "_Connection"])
                    .SubscribeRpcClient <ConnectionStatusIntegrationEventReply, ConnectionStatusRpcClientHandler>(tagGroupReady.Name + ".automation.connection.client.com");

                    TagGroupEventBus.Add(tagGroupReady.Name + "_Connection_Server",
                                         new EventBusRabbitMqRpcServer(PersistentConnection, _loggerFactory, new ConnectionStatusRpcServerHandler(_loggerFactory, _componentContext),
                                                                       null, _exchangeDeclareParameters, _queueDeclareParameters, "BusinessQueueServerRead_" + tagGroupReady.Name, CancellationToken.None));

                    ((IEventBusRpcServer)TagGroupEventBus[tagGroupReady.Name + "_Connection_Server"])
                    .SubscribeRpcServer <TagReadIntegrationEvent, TagReadIntegrationEventReply, TagReadRpcServerHandler>(tagGroupReady.Name + ".automation.connection.server");

                    #endregion

                    TagGroupEventBus.Add(tagGroupReady.Name + "_Invoke",
                                         new EventBusRabbitMqQueue(PersistentConnection, _loggerFactory, new TagInvokeEventHandler(_loggerFactory, _componentContext),
                                                                   null, _exchangeDeclareParameters, _queueDeclareParameters, "BusinessQueueInvoke_" + tagGroupReady.Name, CancellationToken.None));

                    #region [Read]

                    TagGroupEventBus.Add(tagGroupReady.Name + "_Read",
                                         new EventBusRabbitMqRpcClient(PersistentConnection, _loggerFactory, new TagReadRpcClientHandler(_loggerFactory, _componentContext),
                                                                       null, _exchangeDeclareParameters, _queueDeclareParameters, "BusinessQueueRead_" + tagGroupReady.Name, CancellationToken.None));

                    ((IEventBusRpcClient)TagGroupEventBus[tagGroupReady.Name + "_Read"])
                    .SubscribeRpcClient <TagReadIntegrationEventReply, TagReadRpcClientHandler>(tagGroupReady.Name + ".automation.read.client.com");

                    TagGroupEventBus.Add(tagGroupReady.Name + "_Read_Server",
                                         new EventBusRabbitMqRpcServer(PersistentConnection, _loggerFactory, new TagReadRpcServerHandler(_loggerFactory, _componentContext),
                                                                       null, _exchangeDeclareParameters, _queueDeclareParameters, "BusinessQueueServerRead_" + tagGroupReady.Name, CancellationToken.None));

                    ((IEventBusRpcServer)TagGroupEventBus[tagGroupReady.Name + "_Read_Server"])
                    .SubscribeRpcServer <TagReadIntegrationEvent, TagReadIntegrationEventReply, TagReadRpcServerHandler>(tagGroupReady.Name + ".automation.read.server");

                    #endregion

                    #region [Write]

                    TagGroupEventBus.Add(tagGroupReady.Name + "_Write",
                                         new EventBusRabbitMqRpcClient(PersistentConnection, _loggerFactory, new TagWriteRpcHandler(_loggerFactory, _componentContext),
                                                                       null, _exchangeDeclareParameters, _queueDeclareParameters, "BusinessQueueWrite_" + tagGroupReady.Name, CancellationToken.None));

                    ((IEventBusRpcClient)TagGroupEventBus[tagGroupReady.Name + "_Write"])
                    .SubscribeRpcClient <TagWriteIntegrationEventReply, TagWriteRpcClientHandler>(tagGroupReady.Name + ".automation.write.client.com");

                    TagGroupEventBus.Add(tagGroupReady.Name + "_Write_Server",
                                         new EventBusRabbitMqRpcServer(PersistentConnection, _loggerFactory, new TagWriteRpcServerHandler(_loggerFactory, _componentContext),
                                                                       null, _exchangeDeclareParameters, _queueDeclareParameters, "BusinessQueueServerWrite_" + tagGroupReady.Name, CancellationToken.None));

                    ((IEventBusRpcServer)TagGroupEventBus[tagGroupReady.Name + "_Write_Server"])
                    .SubscribeRpcServer <TagWriteIntegrationEvent, TagWriteIntegrationEventReply, TagWriteRpcServerHandler>(tagGroupReady.Name + ".automation.write.server");

                    #endregion

                    if (SystemGroups.ContainsKey(tagGroupReady.Name))
                    {
                        continue;
                    }
                    tagGroupReady.AddLoggerFactory(_loggerFactory);
                    SystemGroups.Add(tagGroupReady.Name, tagGroupReady.GetTagGroup(/*_connectionFactory,*/ _notifierMediatorService));

                    SystemGroups[tagGroupReady.Name]
                    .Initiate(_allTagGroupAllConnection.GetAllTagGroupAllConnection()
                              .Where(tags => tags.TagGroupName.Equals(tagGroupReady.Name))
                              .ToList());

                    //tagGroupReady.Initiate(_allTagGroupAllConnection.AllTagGroupAllConnections
                    //    .Where(tags => tags.TagGroupName.Equals(tagGroupReady.Name)).ToList());
                }
            }
            catch (Exception ex)
            {
                _logger.LogError("LoadGroup: " + ex.Message + " - " + ex.StackTrace);
            }
        }
Ejemplo n.º 6
0
 public bool GetConnectionWriteStatus(string groupName, string connectionName)
 {
     return(SystemGroups.ContainsKey(groupName) && SystemGroups[groupName].GetConnectionStatusWrite(connectionName));
 }