public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); var consumerSetting = new ConsumerSetting { HeartbeatBrokerInterval = 1000, UpdateTopicQueueCountInterval = 1000, RebalanceInterval = 1000 }; _commandExecutedMessageSender = new CommandExecutedMessageSender(); _eventPublisher = new EventPublisher(); configuration.SetDefault<IEventPublisher, EventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(consumerSetting, _commandExecutedMessageSender); _commandConsumer.Subscribe("NoteCommandTopic1"); _commandConsumer.Subscribe("NoteCommandTopic2"); return enodeConfiguration; }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); var brokerStorePath = @"d:\equeue-store"; if (Directory.Exists(brokerStorePath)) { Directory.Delete(brokerStorePath, true); } configuration.RegisterEQueueComponents(); _broker = BrokerController.Create(); _commandResultProcessor = new CommandResultProcessor(new IPEndPoint(SocketUtils.GetLocalIPV4(), 9000)); _commandService = new CommandService(_commandResultProcessor); _eventPublisher = new DomainEventPublisher(); configuration.SetDefault<ICommandService, CommandService>(_commandService); configuration.SetDefault<IMessagePublisher<DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher); //注意,这里实例化之前,需要确保各种MessagePublisher要先注入到IOC,因为CommandConsumer, DomainEventConsumer都依赖于IMessagePublisher<T> _commandConsumer = new CommandConsumer(); _eventConsumer = new DomainEventConsumer(); _commandConsumer.Subscribe("NoteCommandTopic"); _eventConsumer.Subscribe("NoteEventTopic"); return enodeConfiguration; }
public static ENodeConfiguration StartEQueue(this ENodeConfiguration enodeConfiguration) { var nameServerEndpoint = new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.NameServerPort); var nameServerEndpoints = new List <IPEndPoint> { nameServerEndpoint }; //命令消费者 _commandConsumer = new CommandConsumer().Initialize(setting: new ConsumerSetting { NameServerList = nameServerEndpoints }); _commandConsumer.Subscribe(Topics.ShopCommandTopic); //事件生产者 _eventPublisher.Initialize(new ProducerSetting { NameServerList = nameServerEndpoints }); _commandConsumer.Start(); _eventPublisher.Start(); return(enodeConfiguration); }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); _broker = new BrokerController(); _commandResultProcessor = new CommandResultProcessor(); _commandService = new CommandService(_commandResultProcessor); _eventPublisher = new DomainEventPublisher(); configuration.SetDefault <ICommandService, CommandService>(_commandService); configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(); _eventConsumer = new DomainEventConsumer(); _commandConsumer .Subscribe("AccountCommandTopic") .Subscribe("SectionCommandTopic") .Subscribe("PostCommandTopic") .Subscribe("ReplyCommandTopic"); _eventConsumer .Subscribe("AccountEventTopic") .Subscribe("SectionEventTopic") .Subscribe("PostEventTopic") .Subscribe("ReplyEventTopic"); return(enodeConfiguration); }
public static ENodeConfiguration StartEQueue(this ENodeConfiguration enodeConfiguration) { var nameServerEndpoint = new IPEndPoint(IPAddress.Loopback, ConfigSettings.NameServerPort); var nameServerEndpoints = new List <IPEndPoint> { nameServerEndpoint }; _eventPublisher.InitializeEQueue(new ProducerSetting { NameServerList = nameServerEndpoints }); _commandConsumer = new CommandConsumer().InitializeEQueue(setting: new ConsumerSetting { NameServerList = nameServerEndpoints }); _commandConsumer .Subscribe("AccountCommandTopic") .Subscribe("SectionCommandTopic") .Subscribe("PostCommandTopic") .Subscribe("ReplyCommandTopic"); _commandConsumer.Start(); _eventPublisher.Start(); return(enodeConfiguration); }
public static ENodeConfiguration StartEQueue(this ENodeConfiguration enodeConfiguration) { _eventPublisher.Initialize(new ProducerSetting() { NameServerList = ServiceConfigSettings.NameServerEndpoints }); _commandConsumer = new CommandConsumer().Initialize(setting: new ConsumerSetting() { NameServerList = ServiceConfigSettings.NameServerEndpoints, ConsumeFromWhere = ConsumeFromWhere.LastOffset, MessageHandleMode = MessageHandleMode.Parallel, }); _commandConsumer .Subscribe(EQueueTopics.LotteryCommandTopic) .Subscribe(EQueueTopics.LotteryAccountCommandTopic) .Subscribe(EQueueTopics.LotteryProcessManagerTopic) .Subscribe(EQueueTopics.UserInfoCommandTopic) .Subscribe(EQueueTopics.NormCommandTopic) .Subscribe(EQueueTopics.MessageCommandTopic); _commandConsumer.Start(); _eventPublisher.Start(); return(enodeConfiguration); }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); var brokerStorePath = @"c:\equeue-store"; if (Directory.Exists(brokerStorePath)) { Directory.Delete(brokerStorePath, true); } configuration.RegisterEQueueComponents(); _nameServerController = new NameServerController(); _broker = BrokerController.Create(); _commandResultProcessor = new CommandResultProcessor(new IPEndPoint(SocketUtils.GetLocalIPV4(), 9000)); _commandService = new CommandService(_commandResultProcessor); _eventPublisher = new DomainEventPublisher(); configuration.SetDefault <ICommandService, CommandService>(_commandService); configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher); //注意,这里实例化之前,需要确保各种MessagePublisher要先注入到IOC,因为CommandConsumer, DomainEventConsumer都依赖于IMessagePublisher<T> _commandConsumer = new CommandConsumer(); _eventConsumer = new DomainEventConsumer(); _commandConsumer.Subscribe("NoteCommandTopic"); _eventConsumer.Subscribe("NoteEventTopic"); return(enodeConfiguration); }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); var nameServerEndpoint = new IPEndPoint(IPAddress.Loopback, ConfigSettings.NameServerPort); var nameServerEndpoints = new List <IPEndPoint> { nameServerEndpoint }; _eventPublisher = new DomainEventPublisher(new ProducerSetting { NameServerList = nameServerEndpoints }); configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(setting: new ConsumerSetting { NameServerList = nameServerEndpoints }); _commandConsumer .Subscribe("AccountCommandTopic") .Subscribe("SectionCommandTopic") .Subscribe("PostCommandTopic") .Subscribe("ReplyCommandTopic"); return(enodeConfiguration); }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); _domainEventPublisher = new DomainEventPublisher(); configuration.SetDefault<IMessagePublisher<DomainEventStreamMessage>, DomainEventPublisher>(_domainEventPublisher); _commandConsumer = new CommandConsumer(); _commandConsumer.Subscribe("NoteCommandTopic1"); _commandConsumer.Subscribe("NoteCommandTopic2"); return enodeConfiguration; }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); _domainEventPublisher = new DomainEventPublisher(); configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_domainEventPublisher); _commandConsumer = new CommandConsumer(); _commandConsumer.Subscribe("NoteCommandTopic1"); _commandConsumer.Subscribe("NoteCommandTopic2"); return(enodeConfiguration); }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); _eventPublisher = new EventPublisher(); configuration.SetDefault<IPublisher<EventStream>, EventPublisher>(_eventPublisher); configuration.SetDefault<IPublisher<DomainEventStream>, EventPublisher>(_eventPublisher); configuration.SetDefault<IPublisher<IEvent>, EventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(); ObjectContainer.Resolve<ITopicProvider<ICommand>>().GetAllTopics().ForEach(topic => _commandConsumer.Subscribe(topic)); return enodeConfiguration; }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); string dbConfig = System.Configuration.ConfigurationManager.ConnectionStrings["IntDbConn"].ConnectionString; var messageStoreSetting = new SqlServerMessageStoreSetting { ConnectionString = dbConfig, DeleteMessageHourOfDay = -1 }; var offsetManagerSetting = new SqlServerOffsetManagerSetting { ConnectionString = dbConfig }; configuration .RegisterEQueueComponents() .UseSqlServerMessageStore(messageStoreSetting) .UseSqlServerOffsetManager(offsetManagerSetting); _broker = new BrokerController(); _commandResultProcessor = new CommandResultProcessor(); _commandService = new CommandService(_commandResultProcessor); _eventPublisher = new EventPublisher(); configuration.SetDefault<ICommandService, CommandService>(_commandService); configuration.SetDefault<IPublisher<EventStream>, EventPublisher>(_eventPublisher); configuration.SetDefault<IPublisher<DomainEventStream>, EventPublisher>(_eventPublisher); configuration.SetDefault<IPublisher<IEvent>, EventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(); _eventConsumer = new EventConsumer(); var commandTopics = ObjectContainer.Resolve<ITopicProvider<ICommand>>().GetAllTopics(); var eventTopics = ObjectContainer.Resolve<ITopicProvider<IEvent>>().GetAllTopics(); commandTopics.ForEach(topic => _commandConsumer.Subscribe(topic)); eventTopics.ForEach(topic => _eventConsumer.Subscribe(topic)); return enodeConfiguration; }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); _broker = BrokerController.Create(); _commandResultProcessor = new CommandResultProcessor(new IPEndPoint(SocketUtils.GetLocalIPV4(), 9000)); _commandService = new CommandService(_commandResultProcessor); _eventPublisher = new DomainEventPublisher(); configuration.SetDefault <ICommandService, CommandService>(_commandService); configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(); _eventConsumer = new DomainEventConsumer(); _commandConsumer.Subscribe("NoteCommandTopic"); _eventConsumer.Subscribe("NoteEventTopic"); return(enodeConfiguration); }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); _broker = new BrokerController(); _commandResultProcessor = new CommandResultProcessor(); _commandService = new CommandService(_commandResultProcessor); _eventPublisher = new EventPublisher(); configuration.SetDefault<ICommandService, CommandService>(_commandService); configuration.SetDefault<IEventPublisher, EventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(); _eventConsumer = new EventConsumer(); _commandConsumer.Subscribe("BankTransferCommandTopic"); _eventConsumer.Subscribe("BankTransferEventTopic"); return enodeConfiguration; }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); var brokerStorePath = @"c:\forum-equeue-store-test"; if (Directory.Exists(brokerStorePath)) { Directory.Delete(brokerStorePath, true); } configuration.RegisterEQueueComponents(); _broker = BrokerController.Create(new BrokerSetting(brokerStorePath)); _commandResultProcessor = new CommandResultProcessor(new IPEndPoint(SocketUtils.GetLocalIPV4(), 9000)); _commandService = new CommandService(_commandResultProcessor); _eventPublisher = new DomainEventPublisher(); configuration.SetDefault <ICommandService, CommandService>(_commandService); configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(); _eventConsumer = new DomainEventConsumer(); _commandConsumer .Subscribe("AccountCommandTopic") .Subscribe("SectionCommandTopic") .Subscribe("PostCommandTopic") .Subscribe("ReplyCommandTopic"); _eventConsumer .Subscribe("AccountEventTopic") .Subscribe("SectionEventTopic") .Subscribe("PostEventTopic") .Subscribe("ReplyEventTopic"); return(enodeConfiguration); }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); var brokerStorePath = @"d:\equeue-store-test"; if (Directory.Exists(brokerStorePath)) { Directory.Delete(brokerStorePath, true); } configuration.RegisterEQueueComponents(); _broker = BrokerController.Create(new BrokerSetting(brokerStorePath)); _commandResultProcessor = new CommandResultProcessor(new IPEndPoint(SocketUtils.GetLocalIPV4(), 9000)); _commandService = new CommandService(_commandResultProcessor); _eventPublisher = new DomainEventPublisher(); configuration.SetDefault<ICommandService, CommandService>(_commandService); configuration.SetDefault<IMessagePublisher<DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(); _eventConsumer = new DomainEventConsumer(); _commandConsumer .Subscribe("AccountCommandTopic") .Subscribe("SectionCommandTopic") .Subscribe("PostCommandTopic") .Subscribe("ReplyCommandTopic"); _eventConsumer .Subscribe("AccountEventTopic") .Subscribe("SectionEventTopic") .Subscribe("PostEventTopic") .Subscribe("ReplyEventTopic"); return enodeConfiguration; }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); var brokerStorePath = @"c:\forum-equeue-store-test"; if (Directory.Exists(brokerStorePath)) { Directory.Delete(brokerStorePath, true); } configuration.RegisterEQueueComponents(); var nameServerEndpoint = new IPEndPoint(IPAddress.Loopback, ConfigSettings.NameServerPort); var nameServerEndpoints = new List <IPEndPoint> { nameServerEndpoint }; var nameServerSetting = new NameServerSetting() { BindingAddress = nameServerEndpoint }; _nameServer = new NameServerController(nameServerSetting); var brokerSetting = new BrokerSetting(false, brokerStorePath); brokerSetting.NameServerList = nameServerEndpoints; brokerSetting.BrokerInfo.ProducerAddress = new IPEndPoint(IPAddress.Loopback, ConfigSettings.BrokerProducerPort).ToAddress(); brokerSetting.BrokerInfo.ConsumerAddress = new IPEndPoint(IPAddress.Loopback, ConfigSettings.BrokerConsumerPort).ToAddress(); brokerSetting.BrokerInfo.AdminAddress = new IPEndPoint(IPAddress.Loopback, ConfigSettings.BrokerAdminPort).ToAddress(); _broker = BrokerController.Create(brokerSetting); _commandResultProcessor = new CommandResultProcessor(new IPEndPoint(IPAddress.Loopback, 9000)); _commandService = new CommandService(_commandResultProcessor, new ProducerSetting { NameServerList = nameServerEndpoints }); _eventPublisher = new DomainEventPublisher(new ProducerSetting { NameServerList = nameServerEndpoints }); configuration.SetDefault <ICommandService, CommandService>(_commandService); configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(setting: new ConsumerSetting { NameServerList = nameServerEndpoints }); _eventConsumer = new DomainEventConsumer(setting: new ConsumerSetting { NameServerList = nameServerEndpoints }); _commandConsumer .Subscribe("AccountCommandTopic") .Subscribe("SectionCommandTopic") .Subscribe("PostCommandTopic") .Subscribe("ReplyCommandTopic"); _eventConsumer .Subscribe("AccountEventTopic") .Subscribe("SectionEventTopic") .Subscribe("PostEventTopic") .Subscribe("ReplyEventTopic"); return(enodeConfiguration); }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); configuration.SetDefault<ICommandTopicProvider, CommandTopicManager>(); configuration.SetDefault<IEventTopicProvider, EventTopicManager>(); configuration.SetDefault<ICommandTypeCodeProvider, CommandTypeCodeManager>(); var consumerSetting = new ConsumerSetting { HeartbeatBrokerInterval = 1000, UpdateTopicQueueCountInterval = 1000, RebalanceInterval = 1000 }; var eventConsumerSetting = new ConsumerSetting { HeartbeatBrokerInterval = 1000, UpdateTopicQueueCountInterval = 1000, RebalanceInterval = 1000, MessageHandleMode = MessageHandleMode.Sequential }; _broker = new BrokerController().Initialize(); var commandExecutedMessageConsumer = new Consumer(consumerSetting, "CommandExecutedMessageConsumer", "CommandExecutedMessageConsumerGroup_" + ObjectId.GenerateNewId().ToString()); var domainEventHandledMessageConsumer = new Consumer(consumerSetting, "DomainEventHandledMessageConsumer", "DomainEventHandledMessageConsumerGroup_" + ObjectId.GenerateNewId().ToString()); _commandResultProcessor = new CommandResultProcessor(commandExecutedMessageConsumer, domainEventHandledMessageConsumer); _commandService = new CommandService(_commandResultProcessor); _commandExecutedMessageSender = new CommandExecutedMessageSender(); _domainEventHandledMessageSender = new DomainEventHandledMessageSender(); _eventPublisher = new EventPublisher(); configuration.SetDefault<ICommandService, CommandService>(_commandService); configuration.SetDefault<IEventPublisher, EventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(consumerSetting, _commandExecutedMessageSender); _eventConsumer = new EventConsumer(eventConsumerSetting, _domainEventHandledMessageSender); _commandConsumer.Subscribe("NoteCommandTopic"); _eventConsumer.Subscribe("NoteEventTopic"); _commandResultProcessor.SetExecutedCommandMessageTopic("ExecutedCommandMessageTopic"); _commandResultProcessor.SetDomainEventHandledMessageTopic("DomainEventHandledMessageTopic"); return enodeConfiguration; }
public static ENodeConfiguration StartEQueue(this ENodeConfiguration enodeConfiguration) { var nameServerSetting = new NameServerSetting() { BindingAddress = ServiceConfigSettings.NameServerAddress }; _nameServer = new NameServerController(nameServerSetting); var brokerStorePath = @"c:\Lottery\lottery-equeue-store-test"; if (Directory.Exists(brokerStorePath)) { Directory.Delete(brokerStorePath, true); } var brokerSetting = new BrokerSetting(false, brokerStorePath) { NameServerList = ServiceConfigSettings.NameServerEndpoints, }; brokerSetting.BrokerInfo.ProducerAddress = ServiceConfigSettings.BrokerProducerServiceAddress; brokerSetting.BrokerInfo.ConsumerAddress = ServiceConfigSettings.BrokerConsumerServiceAddress; brokerSetting.BrokerInfo.AdminAddress = ServiceConfigSettings.BrokerAdminServiceAddress; _broker = BrokerController.Create(brokerSetting); _commandService.Initialize(new CommandResultProcessor().Initialize(new IPEndPoint(IPAddress.Loopback, 9000)), new ProducerSetting { NameServerList = ServiceConfigSettings.NameServerEndpoints, }); _eventPublisher.Initialize(new ProducerSetting { NameServerList = ServiceConfigSettings.NameServerEndpoints }); _commandConsumer = new CommandConsumer().Initialize(setting: new ConsumerSetting { NameServerList = ServiceConfigSettings.NameServerEndpoints, ConsumeFromWhere = ConsumeFromWhere.LastOffset, MessageHandleMode = MessageHandleMode.Sequential, IgnoreLastConsumedOffset = true, AutoPull = true }); _eventConsumer = new DomainEventConsumer().Initialize(setting: new ConsumerSetting { NameServerList = ServiceConfigSettings.NameServerEndpoints, ConsumeFromWhere = ConsumeFromWhere.LastOffset, MessageHandleMode = MessageHandleMode.Sequential, IgnoreLastConsumedOffset = true, AutoPull = true }); _commandConsumer .Subscribe(EQueueTopics.LotteryCommandTopic) .Subscribe(EQueueTopics.LotteryAccountCommandTopic) .Subscribe(EQueueTopics.NormCommandTopic) ; _eventConsumer .Subscribe(EQueueTopics.LotteryEventTopic) .Subscribe(EQueueTopics.LotteryAccountEventTopic) .Subscribe(EQueueTopics.NormEventTopic); _nameServer.Start(); _broker.Start(); _eventConsumer.Start(); _commandConsumer.Start(); _eventPublisher.Start(); _commandService.Start(); // WaitAllConsumerLoadBalanceComplete(); return(enodeConfiguration); }
public static ENodeConfiguration StartEQueue(this ENodeConfiguration enodeConfiguration) { if (_isEQueueStarted) { _commandService.InitializeENode(); _eventPublisher.InitializeENode(); _commandConsumer.InitializeENode(); _eventConsumer.InitializeENode(); return(enodeConfiguration); } var nameServerEndpoint = new IPEndPoint(IPAddress.Loopback, ConfigSettings.NameServerPort); var nameServerEndpoints = new List <IPEndPoint> { nameServerEndpoint }; var nameServerSetting = new NameServerSetting() { BindingAddress = nameServerEndpoint }; _nameServerController = new NameServerController(nameServerSetting); var brokerStorePath = @"d:\forum-equeue-store-test"; if (Directory.Exists(brokerStorePath)) { Directory.Delete(brokerStorePath, true); } var brokerSetting = new BrokerSetting(false, brokerStorePath) { NameServerList = nameServerEndpoints }; brokerSetting.BrokerInfo.ProducerAddress = new IPEndPoint(IPAddress.Loopback, ConfigSettings.BrokerProducerPort).ToAddress(); brokerSetting.BrokerInfo.ConsumerAddress = new IPEndPoint(IPAddress.Loopback, ConfigSettings.BrokerConsumerPort).ToAddress(); brokerSetting.BrokerInfo.AdminAddress = new IPEndPoint(IPAddress.Loopback, ConfigSettings.BrokerAdminPort).ToAddress(); _broker = BrokerController.Create(brokerSetting); _commandService.InitializeEQueue(new CommandResultProcessor().Initialize(new IPEndPoint(IPAddress.Loopback, 9000)), new ProducerSetting { NameServerList = nameServerEndpoints }); _eventPublisher.InitializeEQueue(new ProducerSetting { NameServerList = nameServerEndpoints }); _commandConsumer = new CommandConsumer().InitializeEQueue(setting: new ConsumerSetting { NameServerList = nameServerEndpoints }); _eventConsumer = new DomainEventConsumer().InitializeEQueue(setting: new ConsumerSetting { NameServerList = nameServerEndpoints }); _commandConsumer .Subscribe("AccountCommandTopic") .Subscribe("SectionCommandTopic") .Subscribe("PostCommandTopic") .Subscribe("ReplyCommandTopic"); _eventConsumer .Subscribe("AccountEventTopic") .Subscribe("SectionEventTopic") .Subscribe("PostEventTopic") .Subscribe("ReplyEventTopic"); _nameServerController.Start(); _broker.Start(); _eventConsumer.Start(); _commandConsumer.Start(); _eventPublisher.Start(); _commandService.Start(); WaitAllConsumerLoadBalanceComplete(); _isEQueueStarted = true; return(enodeConfiguration); }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); _broker = new BrokerController(); _commandResultProcessor = new CommandResultProcessor(); _commandService = new CommandService(_commandResultProcessor); _eventPublisher = new DomainEventPublisher(); configuration.SetDefault<ICommandService, CommandService>(_commandService); configuration.SetDefault<IMessagePublisher<DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(); _eventConsumer = new DomainEventConsumer(); _commandConsumer .Subscribe("AccountCommandTopic") .Subscribe("SectionCommandTopic") .Subscribe("PostCommandTopic") .Subscribe("ReplyCommandTopic"); _eventConsumer .Subscribe("AccountEventTopic") .Subscribe("SectionEventTopic") .Subscribe("PostEventTopic") .Subscribe("ReplyEventTopic"); return enodeConfiguration; }