Exemplo n.º 1
0
        private static void InitializeEQueue()
        {
            ConfigSettings.Initialize();

            var queueStoreSetting = new SqlServerQueueStoreSetting
            {
                ConnectionString = ConfigSettings.ConnectionString
            };
            var messageStoreSetting = new SqlServerMessageStoreSetting
            {
                ConnectionString   = ConfigSettings.ConnectionString,
                MessageLogFilePath = "/equeue_message_logs"
            };
            var offsetManagerSetting = new SqlServerOffsetManagerSetting
            {
                ConnectionString = ConfigSettings.ConnectionString
            };

            _ecommonConfiguration
            .RegisterEQueueComponents()
            .UseSqlServerQueueStore(queueStoreSetting)
            .UseSqlServerMessageStore(messageStoreSetting)
            .UseSqlServerOffsetManager(offsetManagerSetting);

            _broker = BrokerController.Create();
            _logger.Info("EQueue initialized.");
        }
Exemplo n.º 2
0
        private static void InitializeEQueue()
        {
            _ecommonConfiguration = ECommonConfiguration
                                    .Create()
                                    .UseAutofac()
                                    .RegisterCommonComponents()
                                    .UseLog4Net()
                                    .UseJsonNet()
                                    .RegisterUnhandledExceptionHandler()
                                    .RegisterEQueueComponents()
                                    .BuildContainer();

            ServiceConfigSettings.Initialize();

            var brokerSetting = new BrokerSetting(false, ServiceConfigSettings.EqueueStorePath)
            {
                NameServerList = ServiceConfigSettings.NameServerEndpoints
            };

            brokerSetting.BrokerInfo.ProducerAddress = ServiceConfigSettings.BrokerProducerServiceAddress;
            brokerSetting.BrokerInfo.ConsumerAddress = ServiceConfigSettings.BrokerConsumerServiceAddress;
            brokerSetting.BrokerInfo.AdminAddress    = ServiceConfigSettings.BrokerAdminServiceAddress;
            brokerSetting.BrokerInfo.BrokerName      = ServiceConfigSettings.BrokerName;
            brokerSetting.BrokerInfo.GroupName       = ServiceConfigSettings.BrokerGroup;

            _broker = BrokerController.Create(brokerSetting);
            ObjectContainer.Resolve <ILoggerFactory>().Create(typeof(Program).FullName).Info("Broker initialized.");
        }
Exemplo n.º 3
0
        private static void InitializeEQueue()
        {
            ConfigSettings.Initialize();

            var queueStoreSetting = new SqlServerQueueStoreSetting
            {
                ConnectionString = ConfigSettings.ConferenceEQueueConnectionString
            };
            var messageStoreSetting = new SqlServerMessageStoreSetting
            {
                ConnectionString   = ConfigSettings.ConferenceEQueueConnectionString,
                MessageLogFilePath = "/home/admin/logs/conference/equeue"
            };
            var offsetManagerSetting = new SqlServerOffsetManagerSetting
            {
                ConnectionString = ConfigSettings.ConferenceEQueueConnectionString
            };

            _configuration
            .RegisterEQueueComponents()
            .UseSqlServerQueueStore(queueStoreSetting)
            .UseSqlServerMessageStore(messageStoreSetting)
            .UseSqlServerOffsetManager(offsetManagerSetting);

            var setting = new BrokerSetting
            {
                ProducerIPEndPoint = new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.BrokerProducerPort),
                ConsumerIPEndPoint = new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.BrokerConsumerPort),
                AdminIPEndPoint    = new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.BrokerAdminPort)
            };

            _broker = BrokerController.Create(setting);
            _logger.Info("EQueue initialized.");
        }
Exemplo n.º 4
0
        public static Configuration StartEqueueBroker(this Configuration configuration, int producerPort = 5000, int consumerPort = 5001, int adminPort = 5002)
        {
            var setting = new BrokerSetting(
                bool.Parse(ConfigurationManager.AppSettings["isMemoryMode"]),
                ConfigurationManager.AppSettings["fileStoreRootPath"],
                chunkCacheMaxPercent: 95,
                chunkFlushInterval: int.Parse(ConfigurationManager.AppSettings["flushInterval"]),
                messageChunkDataSize: int.Parse(ConfigurationManager.AppSettings["chunkSize"]) * 1024 * 1024,
                chunkWriteBuffer: int.Parse(ConfigurationManager.AppSettings["chunkWriteBuffer"]) * 1024,
                enableCache: bool.Parse(ConfigurationManager.AppSettings["enableCache"]),
                chunkCacheMinPercent: int.Parse(ConfigurationManager.AppSettings["chunkCacheMinPercent"]),
                messageChunkLocalCacheSize: 30 * 10000,
                queueChunkLocalCacheSize: 10000)
            {
                AutoCreateTopic            = true,
                ProducerAddress            = new IPEndPoint(SocketUtils.GetLocalIPV4(), producerPort),
                ConsumerAddress            = new IPEndPoint(SocketUtils.GetLocalIPV4(), consumerPort),
                AdminAddress               = new IPEndPoint(SocketUtils.GetLocalIPV4(), adminPort),
                NotifyWhenMessageArrived   = true,
                MessageWriteQueueThreshold = int.Parse(ConfigurationManager.AppSettings["messageWriteQueueThreshold"])
            };

            BrokerController.Create(setting).Start();
            return(configuration);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            using (var bootstrapper = new AbpBootstrapper())
            {
                bootstrapper.Initialize();

                var setting = new BrokerSetting(
                    bool.Parse(ConfigurationManager.AppSettings["isMemoryMode"]),
                    ConfigurationManager.AppSettings["fileStoreRootPath"],
                    chunkCacheMaxPercent: 95,
                    chunkFlushInterval: int.Parse(ConfigurationManager.AppSettings["flushInterval"]),
                    messageChunkDataSize: int.Parse(ConfigurationManager.AppSettings["chunkSize"]) * 1024 * 1024,
                    chunkWriteBuffer: int.Parse(ConfigurationManager.AppSettings["chunkWriteBuffer"]) * 1024,
                    enableCache: bool.Parse(ConfigurationManager.AppSettings["enableCache"]),
                    chunkCacheMinPercent: int.Parse(ConfigurationManager.AppSettings["chunkCacheMinPercent"]),
                    syncFlush: bool.Parse(ConfigurationManager.AppSettings["syncFlush"]),
                    messageChunkLocalCacheSize: 30 * 10000,
                    queueChunkLocalCacheSize: 10000)
                {
                    NotifyWhenMessageArrived   = bool.Parse(ConfigurationManager.AppSettings["notifyWhenMessageArrived"]),
                    MessageWriteQueueThreshold = int.Parse(ConfigurationManager.AppSettings["messageWriteQueueThreshold"])
                };
                BrokerController.Create(setting).Start();
                Console.ReadLine();
            }
        }
Exemplo n.º 6
0
        private static void InitializeEQueue()
        {
            _ecommonConfiguration = ECommonConfiguration
                                    .Create()
                                    .UseAutofac()
                                    .RegisterCommonComponents()
                                    .UseLog4Net()
                                    .UseJsonNet()
                                    .RegisterUnhandledExceptionHandler()
                                    .RegisterEQueueComponents()
                                    .BuildContainer();
            ConfigSettings.Initialize();
            var storePath           = ConfigurationManager.AppSettings["equeueStorePath"];
            var nameServerEndpoint  = new IPEndPoint(IPAddress.Loopback, ConfigSettings.NameServerPort);
            var nameServerEndpoints = new List <IPEndPoint> {
                nameServerEndpoint
            };
            var brokerSetting = new BrokerSetting(false, storePath)
            {
                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);
            ObjectContainer.Resolve <ILoggerFactory>().Create(typeof(Bootstrap).FullName).Info("Broker initialized.");
        }
Exemplo n.º 7
0
        public static ENodeConfiguration StartEQueue(this ENodeConfiguration enodeConfiguration)
        {
            //var configuration = enodeConfiguration.GetCommonConfiguration();
            _commandService.Initialize(
                new CommandResultProcessor().Initialize(
                    new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.BrokerCommandPort)));
            _eventPublisher.Initialize();

            _commandConsumer = new CommandConsumer().Initialize().Subscribe(EQueueTopics.NoteCommandTopic);
            _eventConsumer   = new DomainEventConsumer().Initialize().Subscribe(EQueueTopics.NoteEventTopic);

            var brokerStorePath = @"d:\note-sample-equeue-store";

            if (Directory.Exists(brokerStorePath))
            {
                Directory.Delete(brokerStorePath, true);
            }

            _nameServer = new NameServerController();
            _broker     = BrokerController.Create();

            _nameServer.Start();
            _broker.Start();
            _commandService.Start();
            _eventConsumer.Start();
            _commandConsumer.Start();
            _eventPublisher.Start();

            WaitAllConsumerLoadBalanceComplete();

            return(enodeConfiguration);
        }
Exemplo n.º 8
0
        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("AccountCommandTopic")
            .Subscribe("SectionCommandTopic")
            .Subscribe("PostCommandTopic")
            .Subscribe("ReplyCommandTopic");
            _eventConsumer
            .Subscribe("AccountEventTopic")
            .Subscribe("SectionEventTopic")
            .Subscribe("PostEventTopic")
            .Subscribe("ReplyEventTopic");

            return(enodeConfiguration);
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            InitializeEQueue();

            var address           = ConfigurationManager.AppSettings["nameServerAddress"];
            var nameServerAddress = string.IsNullOrEmpty(address) ? SocketUtils.GetLocalIPV4() : IPAddress.Parse(address);
            var setting           = new BrokerSetting(
                isMessageStoreMemoryMode: bool.Parse(ConfigurationManager.AppSettings["isMemoryMode"]),
                chunkFileStoreRootPath: ConfigurationManager.AppSettings["fileStoreRootPath"],
                chunkFlushInterval: int.Parse(ConfigurationManager.AppSettings["flushInterval"]),
                chunkCacheMaxCount: int.Parse(ConfigurationManager.AppSettings["chunkCacheMaxCount"]),
                chunkCacheMinCount: int.Parse(ConfigurationManager.AppSettings["chunkCacheMinCount"]),
                messageChunkDataSize: int.Parse(ConfigurationManager.AppSettings["chunkSize"]) * 1024 * 1024,
                chunkWriteBuffer: int.Parse(ConfigurationManager.AppSettings["chunkWriteBuffer"]) * 1024,
                enableCache: bool.Parse(ConfigurationManager.AppSettings["enableCache"]),
                syncFlush: bool.Parse(ConfigurationManager.AppSettings["syncFlush"]),
                messageChunkLocalCacheSize: 30 * 10000,
                queueChunkLocalCacheSize: 10000)
            {
                NotifyWhenMessageArrived      = bool.Parse(ConfigurationManager.AppSettings["notifyWhenMessageArrived"]),
                MessageWriteQueueThreshold    = int.Parse(ConfigurationManager.AppSettings["messageWriteQueueThreshold"]),
                DeleteMessageIgnoreUnConsumed = bool.Parse(ConfigurationManager.AppSettings["deleteMessageIgnoreUnConsumed"])
            };

            setting.NameServerList = new List <IPEndPoint> {
                new IPEndPoint(nameServerAddress, 9493)
            };
            setting.BrokerInfo.BrokerName      = ConfigurationManager.AppSettings["brokerName"];
            setting.BrokerInfo.GroupName       = ConfigurationManager.AppSettings["groupName"];
            setting.BrokerInfo.ProducerAddress = new IPEndPoint(SocketUtils.GetLocalIPV4(), int.Parse(ConfigurationManager.AppSettings["producerPort"])).ToAddress();
            setting.BrokerInfo.ConsumerAddress = new IPEndPoint(SocketUtils.GetLocalIPV4(), int.Parse(ConfigurationManager.AppSettings["consumerPort"])).ToAddress();
            setting.BrokerInfo.AdminAddress    = new IPEndPoint(SocketUtils.GetLocalIPV4(), int.Parse(ConfigurationManager.AppSettings["adminPort"])).ToAddress();
            BrokerController.Create(setting).Start();
            Console.ReadLine();
        }
Exemplo n.º 10
0
        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);
            _applicationMessagePublisher = new ApplicationMessagePublisher();
            _domainEventPublisher        = new DomainEventPublisher();
            _exceptionPublisher          = new PublishableExceptionPublisher();

            configuration.SetDefault <ICommandService, CommandService>(_commandService);
            configuration.SetDefault <IMessagePublisher <IApplicationMessage>, ApplicationMessagePublisher>(_applicationMessagePublisher);
            configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_domainEventPublisher);
            configuration.SetDefault <IMessagePublisher <IPublishableException>, PublishableExceptionPublisher>(_exceptionPublisher);

            _commandConsumer            = new CommandConsumer().Subscribe("BankTransferCommandTopic");
            _applicationMessageConsumer = new ApplicationMessageConsumer().Subscribe("BankTransferApplicationMessageTopic");
            _eventConsumer     = new DomainEventConsumer().Subscribe("BankTransferEventTopic");
            _exceptionConsumer = new PublishableExceptionConsumer().Subscribe("BankTransferExceptionTopic");

            return(enodeConfiguration);
        }
Exemplo n.º 11
0
        public static ENodeConfiguration StartEQueue(this ENodeConfiguration enodeConfiguration)
        {
            var brokerStorePath = ConfigurationManager.AppSettings["equeue-store-path"];

            if (Directory.Exists(brokerStorePath))
            {
                Directory.Delete(brokerStorePath, true);
            }

            var configuration = enodeConfiguration.GetCommonConfiguration();

            _commandService.InitializeEQueue(new CommandResultProcessor().Initialize(new IPEndPoint(SocketUtils.GetLocalIPV4(), 9000)));
            _eventPublisher.InitializeEQueue();
            _commandConsumer = new CommandConsumer().InitializeEQueue().Subscribe("NoteCommandTopic");
            _eventConsumer   = new DomainEventConsumer().InitializeEQueue().Subscribe("NoteEventTopic");

            _nameServerController = new NameServerController();
            _broker = BrokerController.Create(new BrokerSetting(chunkFileStoreRootPath: brokerStorePath));

            _nameServerController.Start();
            _broker.Start();
            _eventConsumer.Start();
            _commandConsumer.Start();
            _eventPublisher.Start();
            _commandService.Start();

            WaitAllProducerTopicQueuesAvailable();
            WaitAllConsumerLoadBalanceComplete();

            return(enodeConfiguration);
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            InitializeEQueue();
            BrokerController.Create().Start();

            ObjectContainer.Resolve <ILoggerFactory>().Create(typeof(Program).Name).Info("Broker started, press Enter to exit...");
            Console.ReadLine();
        }
Exemplo n.º 14
0
 static void Main(string[] args)
 {
     InitializeEQueue();
     BrokerController.Create(new BrokerSetting {
         NotifyWhenMessageArrived = false
     }).Start();
     Console.ReadLine();
 }
Exemplo n.º 15
0
        private static void InitializeEQueue()
        {
            _ecommonConfiguration.RegisterEQueueComponents();
            var storePath = ConfigurationManager.AppSettings["equeueStorePath"];

            _broker = BrokerController.Create(new BrokerSetting(storePath));
            _logger.Info("EQueue initialized.");
        }
Exemplo n.º 16
0
        public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration)
        {
            var configuration   = enodeConfiguration.GetCommonConfiguration();
            var brokerStorePath = @"c:\person-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);

            var producerSetting = new ProducerSetting
            {
                NameServerList = new List <IPEndPoint> {
                    new IPEndPoint(IPAddress.Loopback, ConfigSettings.NameServerPort)
                }
            };
            var consumerSetting = new ConsumerSetting
            {
                NameServerList = new List <IPEndPoint> {
                    new IPEndPoint(IPAddress.Loopback, ConfigSettings.NameServerPort)
                }
            };

            _commandResultProcessor = new CommandResultProcessor(new IPEndPoint(IPAddress.Loopback, 9003));
            _commandService         = new CommandService(_commandResultProcessor, producerSetting);
            _eventPublisher         = new DomainEventPublisher(producerSetting);

            configuration.SetDefault <ICommandService, CommandService>(_commandService);
            configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher);

            _commandConsumer = new CommandConsumer(setting: consumerSetting)
                               .Subscribe(Topics.PersonCommandTopic);
            _eventConsumer = new DomainEventConsumer(setting: consumerSetting)
                             .Subscribe(Topics.PersonDomainEventTopic);

            return(enodeConfiguration);
        }
Exemplo n.º 17
0
        public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration)
        {
            var configuration = enodeConfiguration.GetCommonConfiguration();

            configuration.RegisterEQueueComponents();
            _broker         = BrokerController.Create();
            _eventPublisher = new DomainEventPublisher();
            configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher);
            return(enodeConfiguration);
        }
Exemplo n.º 18
0
        public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration)
        {
            var configuration = enodeConfiguration.GetCommonConfiguration();

            configuration.RegisterEQueueComponents();
            _broker         = BrokerController.Create();
            _commandService = new CommandService();
            configuration.SetDefault <ICommandService, CommandService>(_commandService);
            return(enodeConfiguration);
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            InitializeEQueue();
            var setting = new BrokerSetting
            {
                TopicDefaultQueueCount = 1
            };

            BrokerController.Create(setting).Start();
            Console.ReadLine();
        }
Exemplo n.º 20
0
 static void Main(string[] args)
 {
     InitializeEQueue();
     BrokerController.Create(new BrokerSetting(
                                 ConfigurationManager.AppSettings["fileStoreRootPath"],
                                 chunkCacheMaxPercent: 95,
                                 chunkFlushInterval: int.Parse(ConfigurationManager.AppSettings["flushInterval"]),
                                 messageChunkDataSize: int.Parse(ConfigurationManager.AppSettings["chunkSize"]) * 1024 * 1024,
                                 chunkWriteBuffer: int.Parse(ConfigurationManager.AppSettings["chunkWriteBuffer"]) * 1024,
                                 enableCache: bool.Parse(ConfigurationManager.AppSettings["enableCache"]))).Start();
     Console.ReadLine();
 }
Exemplo n.º 21
0
        private static void InitializeEQueue()
        {
            _configuration.RegisterEQueueComponents();
            var storePath = ConfigurationManager.AppSettings["equeueStorePath"];
            var setting   = new BrokerSetting(storePath)
            {
                ProducerAddress = new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.BrokerProducerPort),
                ConsumerAddress = new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.BrokerConsumerPort),
                AdminAddress    = new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.BrokerAdminPort)
            };

            _broker = BrokerController.Create(setting);
            _logger.Info("EQueue initialized.");
        }
Exemplo n.º 22
0
        static void Main(string[] args)
        {
            InitializeEQueue();

            var bindingIP      = ConfigurationManager.AppSettings["BindingAddress"];
            var brokerEndPoint = string.IsNullOrEmpty(bindingIP) ? SocketUtils.GetLocalIPV4() : IPAddress.Parse(bindingIP);
            var setting        = new BrokerSetting {
                ProducerIPEndPoint = new IPEndPoint(brokerEndPoint, 5000),
                ConsumerIPEndPoint = new IPEndPoint(brokerEndPoint, 5001),
                AdminIPEndPoint    = new IPEndPoint(brokerEndPoint, 5002)
            };

            BrokerController.Create(setting).Start();
            Console.ReadLine();
        }
Exemplo n.º 23
0
        public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration)
        {
            var configuration = enodeConfiguration.GetCommonConfiguration();

            configuration.RegisterEQueueComponents();
            _broker         = BrokerController.Create();
            _commandService = new CommandService(new CommandResultProcessor(new IPEndPoint(SocketUtils.GetLocalIPV4(), 9001)));
            configuration.SetDefault <ICommandService, CommandService>(_commandService);

            _commandConsumer = new CommandConsumer(setting: new ConsumerSetting {
                ConsumeFromWhere = ConsumeFromWhere.FirstOffset
            }).Subscribe("NoteCommandTopic");

            return(enodeConfiguration);
        }
Exemplo n.º 24
0
        private void InitializeEQueue()
        {
            _configuration.RegisterEQueueComponents();
            var storePath = ConfigurationManager.AppSettings["equeueStorePath"];
            var setting   = new BrokerSetting(false, storePath);

            setting.NameServerList = new List <IPEndPoint> {
                new IPEndPoint(SocketUtils.GetLocalIPV4(), 10000)
            };
            setting.BrokerInfo.BrokerName      = "GloodBroker";
            setting.BrokerInfo.GroupName       = "GloodGroupName";
            setting.BrokerInfo.ProducerAddress = new IPEndPoint(SocketUtils.GetLocalIPV4(), 10001).ToAddress();
            setting.BrokerInfo.AdminAddress    = new IPEndPoint(SocketUtils.GetLocalIPV4(), 10003).ToAddress();
            _broker = BrokerController.Create(setting);
            _logger.Info("EQueue initialized.");
        }
Exemplo n.º 25
0
        static void Main(string[] args)
        {
            InitializeEQueue();

            var brokerStorePath = @"d:\equeue-store";

            if (Directory.Exists(brokerStorePath))
            {
                Directory.Delete(brokerStorePath, true);
            }

            BrokerController.Create().Start();

            ObjectContainer.Resolve <ILoggerFactory>().Create(typeof(Program).Name).Info("Broker started, press Enter to exit...");
            Console.ReadLine();
        }
Exemplo n.º 26
0
        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();
            _commandService = new CommandService();
            configuration.SetDefault <ICommandService, CommandService>(_commandService);
            return(enodeConfiguration);
        }
Exemplo n.º 27
0
        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();
            _eventPublisher = new DomainEventPublisher();
            configuration.SetDefault <IMessagePublisher <DomainEventStreamMessage>, DomainEventPublisher>(_eventPublisher);
            return(enodeConfiguration);
        }
Exemplo n.º 28
0
        public static ENodeConfiguration StartEQueue(this ENodeConfiguration enodeConfiguration)
        {
            var brokerStorePath = ConfigurationManager.AppSettings["equeue-store-path"];

            if (Directory.Exists(brokerStorePath))
            {
                Directory.Delete(brokerStorePath, true);
            }

            _commandService.InitializeEQueue(new CommandResultProcessor().Initialize(new IPEndPoint(SocketUtils.GetLocalIPV4(), 9001)));
            _applicationMessagePublisher.InitializeEQueue();
            _domainEventPublisher.InitializeEQueue();
            _exceptionPublisher.InitializeEQueue();

            _nameServerController = new NameServerController();
            _broker = BrokerController.Create(new BrokerSetting(chunkFileStoreRootPath: brokerStorePath));

            _commandConsumer            = new CommandConsumer().InitializeEQueue().Subscribe(Constants.CommandTopic);
            _applicationMessageConsumer = new ApplicationMessageConsumer().InitializeEQueue().Subscribe(Constants.ApplicationMessageTopic);
            _eventConsumer     = new DomainEventConsumer().InitializeEQueue().Subscribe(Constants.EventTopic);
            _exceptionConsumer = new DomainExceptionConsumer().InitializeEQueue().Subscribe(Constants.ExceptionTopic);
            _nameServerSocketRemotingClient = new SocketRemotingClient("NameServerRemotingClient", new IPEndPoint(SocketUtils.GetLocalIPV4(), 9493));

            _nameServerController.Start();
            _broker.Start();
            _exceptionConsumer.Start();
            _eventConsumer.Start();
            _applicationMessageConsumer.Start();
            _commandConsumer.Start();
            _applicationMessagePublisher.Start();
            _domainEventPublisher.Start();
            _exceptionPublisher.Start();
            _commandService.Start();
            _nameServerSocketRemotingClient.Start();

            //生产环境不需要以下这段代码
            CreateTopic(Constants.CommandTopic);
            CreateTopic(Constants.EventTopic);
            CreateTopic(Constants.ApplicationMessageTopic);
            CreateTopic(Constants.ExceptionTopic);
            WaitAllProducerTopicQueuesAvailable();
            WaitAllConsumerLoadBalanceComplete();

            return(enodeConfiguration);
        }
Exemplo n.º 29
0
        public static ENodeConfiguration StartEQueue(this ENodeConfiguration enodeConfiguration)
        {
            var brokerStorePath = @"c:\equeue-store";
            if (Directory.Exists(brokerStorePath))
            {
                Directory.Delete(brokerStorePath, true);
            }

            _eventPublisher.Initialize();

            _nameServerController = new NameServerController();
            _broker = BrokerController.Create();

            _nameServerController.Start();
            _broker.Start();
            _eventPublisher.Start();
            return enodeConfiguration;
        }
Exemplo n.º 30
0
        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(new BrokerSetting {
                NotifyWhenMessageArrived = false
            });
            _commandService = new CommandService();
            configuration.SetDefault <ICommandService, CommandService>(_commandService);
            return(enodeConfiguration);
        }