public Srv.Dto.View.Common.List.TagGroupReady TagGroupReady(CallContext context = default) { _logger.LogTrace("Query: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name); var repository = _tagGroupReadyRepository.GetAllTagGroupReady(); var tagGroupItems = repository.ToList().Select( tagGroup => _mapper.Map <Srv.Dto.View.Common.TagGroupReady>(tagGroup) ).ToList(); var output = new Srv.Dto.View.Common.List.TagGroupReady(tagGroupItems); return(output); }
private void LoadGroups() { try { DefaultRabbitMqPersistentConnection persistentConnection = new DefaultRabbitMqPersistentConnection(_connectionFactory, _loggerFactory); foreach (var tagGroupReady in _tagGroupReady.GetAllTagGroupReady()) { var queueInvokeHandler = new TagInvokeQueueHandler(_loggerFactory, _componentContext); //var queueReadHandler = // new TagReadQueueHandler(_loggerFactory); TagGroupEventBus.Add(tagGroupReady.Name + "_Invoke", new EventBusRabbitMqQueue(persistentConnection, _loggerFactory, queueInvokeHandler, null, _exchangeDeclareParameters, _queueDeclareParameters, "TransactionQueueInvoke_" + tagGroupReady.Name, CancellationToken.None)); //TagGroupEventBus.Add(tagGroupReady.Name + "_Read", // new EventBusRabbitMq(persistentConnection, _loggerFactory, queueReadHandler, null, "direct", // "TransactionQueueRead_" + tagGroupReady.Name, CancellationToken.None, true)); ((IEventBusQueue)TagGroupEventBus[tagGroupReady.Name + "_Invoke"]) .SubscribeQueue <TagIntegrationEvent, TagInvokeQueueHandler>( tagGroupReady.Name + ".automation.invoke"); //TagGroupEventBus[tagGroupReady.Name + "_Read"] // .SubscribeRpc<TagReadIntegrationEvent, TagReadQueueHandler>( // tagGroupReady.Name + ".automation.read"); //TagGroupEventBus[tagGroupReady.Name + "_Read"] // .SubscribeRpc<TagReadIntegrationEvent, // TagReadIntegrationEventResult, // TagReadIntegrationEventReply, // TagReadEventHandlerRpc>(tagGroupReady.Name + ".automation.read"); } } catch (Exception ex) { _logger.LogError("LoadGroups: " + ex.Message + " - " + ex.StackTrace); } }
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); } }