Esempio n. 1
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);
        }
Esempio n. 2
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();
            }
        }
 public SendMessageRequestHandler(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _messageService = ObjectContainer.Resolve<IMessageService>();
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().Name);
 }
Esempio 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);
        }
Esempio n. 5
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);
        }
Esempio 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.");
        }
Esempio n. 7
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.");
        }
Esempio n. 8
0
 public SendMessageRequestHandler(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _messageService   = ObjectContainer.Resolve <IMessageService>();
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
     _logger           = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
 }
Esempio n. 9
0
        public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration)
        {
            var configuration = enodeConfiguration.GetCommonConfiguration();

            configuration.RegisterEQueueComponents();

            _broker = new BrokerController();

            _commandResultProcessor      = new CommandResultProcessor();
            _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);
        }
Esempio n. 10
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();
        }
Esempio n. 11
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);
        }
Esempio n. 12
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.");
        }
Esempio n. 13
0
        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);
        }
Esempio n. 14
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);
        }
Esempio n. 15
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.");
        }
Esempio n. 16
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();
        }
Esempio n. 17
0
 static void Main(string[] args)
 {
     InitializeEQueue();
     BrokerController.Create(new BrokerSetting {
         NotifyWhenMessageArrived = false
     }).Start();
     Console.ReadLine();
 }
Esempio n. 18
0
        private static void InitializeEQueue()
        {
            _ecommonConfiguration.RegisterEQueueComponents();
            var storePath = ConfigurationManager.AppSettings["equeueStorePath"];

            _broker = BrokerController.Create(new BrokerSetting(storePath));
            _logger.Info("EQueue initialized.");
        }
 public SendMessageRequestHandler(BrokerController brokerController)
 {
     _brokerController            = brokerController;
     _suspendedPullRequestManager = ObjectContainer.Resolve <SuspendedPullRequestManager>();
     _messageStore = ObjectContainer.Resolve <IMessageStore>();
     _queueStore   = ObjectContainer.Resolve <IQueueStore>();
     _logger       = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
 }
Esempio n. 20
0
 public SendMessageRequestHandler(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _suspendedPullRequestManager = ObjectContainer.Resolve<SuspendedPullRequestManager>();
     _messageStore = ObjectContainer.Resolve<IMessageStore>();
     _queueStore = ObjectContainer.Resolve<IQueueStore>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
 }
Esempio n. 21
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);
        }
Esempio n. 22
0
        public async Task Trending()
        {
            // Act
            var controller = new BrokerController(_logger.Object, _bankService.Object, _brokerService.Object, _context.Object);
            var result     = await controller.Trending();

            // Assert
            Assert.IsType <OkObjectResult>(result.Result);
        }
Esempio n. 23
0
        public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration)
        {
            var configuration = enodeConfiguration.GetCommonConfiguration();

            configuration.RegisterEQueueComponents();
            _broker         = new BrokerController();
            _commandService = new CommandService();
            configuration.SetDefault <ICommandService, CommandService>(_commandService);
            return(enodeConfiguration);
        }
Esempio n. 24
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);
        }
Esempio n. 25
0
        public void Index()
        {
            // Arrange
            BrokerController controller = new BrokerController();

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
Esempio n. 26
0
        static void Main(string[] args)
        {
            InitializeEQueue();
            var setting = new BrokerSetting
            {
                TopicDefaultQueueCount = 1
            };

            BrokerController.Create(setting).Start();
            Console.ReadLine();
        }
Esempio n. 27
0
 private static BrokerControllerDelegateWrapper createControllerWrapper(BrokerController control) => new BrokerControllerDelegateWrapper
 {
     newPub        = control.newPublisherConnected,
     newSub        = control.newSubscriberConnected,
     closed        = control.connectionClosed,
     newPubTopic   = control.newPublisherTopic,
     delPubTopic   = control.deletePublisherTopic,
     unsubbed      = control.subscriberUnsubscribedFromTopic,
     newConnect    = control.newConnection,
     newPost       = control.newPost,
     subbedToTopic = control.subscribedToTopic
 };
Esempio n. 28
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();
 }
Esempio n. 29
0
        public SendMessageRequestHandler(BrokerController brokerController)
        {
            _brokerController            = brokerController;
            _suspendedPullRequestManager = ObjectContainer.Resolve <SuspendedPullRequestManager>();
            _messageStore             = ObjectContainer.Resolve <IMessageStore>();
            _queueStore               = ObjectContainer.Resolve <IQueueStore>();
            _notifyWhenMessageArrived = _brokerController.Setting.NotifyWhenMessageArrived;
            _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
            var messageWriteQueueThreshold = brokerController.Setting.MessageWriteQueueThreshold;

            _bufferQueue = new BufferQueue <StoreContext>("QueueBufferQueue", messageWriteQueueThreshold, AddQueueMessage, _logger);
        }
 public SendMessageRequestHandler(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _suspendedPullRequestManager = ObjectContainer.Resolve<SuspendedPullRequestManager>();
     _messageStore = ObjectContainer.Resolve<IMessageStore>();
     _queueStore = ObjectContainer.Resolve<IQueueStore>();
     _tpsStatisticService = ObjectContainer.Resolve<ITpsStatisticService>();
     _notifyWhenMessageArrived = _brokerController.Setting.NotifyWhenMessageArrived;
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     _sendRTLogger = ObjectContainer.Resolve<ILoggerFactory>().Create("SendRT");
     var messageWriteQueueThreshold = brokerController.Setting.MessageWriteQueueThreshold;
     _bufferQueue = new BufferQueue<StoreContext>("QueueBufferQueue", messageWriteQueueThreshold, OnQueueMessageCompleted, _logger);
 }
Esempio n. 31
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.");
        }
Esempio n. 32
0
        public BatchSendMessageRequestHandler(BrokerController brokerController)
        {
            _brokerController            = brokerController;
            _suspendedPullRequestManager = ObjectContainer.Resolve <SuspendedPullRequestManager>();
            _messageStore             = ObjectContainer.Resolve <IMessageStore>();
            _queueStore               = ObjectContainer.Resolve <IQueueStore>();
            _tpsStatisticService      = ObjectContainer.Resolve <ITpsStatisticService>();
            _notifyWhenMessageArrived = _brokerController.Setting.NotifyWhenMessageArrived;
            _logger       = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
            _sendRTLogger = ObjectContainer.Resolve <ILoggerFactory>().Create("BatchSendRT");
            var messageWriteQueueThreshold = brokerController.Setting.BatchMessageWriteQueueThreshold;

            _bufferQueue = new BufferQueue <StoreContext>("QueueBufferQueue", messageWriteQueueThreshold, OnQueueMessageCompleted, _logger);
        }
Esempio n. 33
0
        private void DeleteBroker_ShouldReturnOK()
        {
            using (var broker = new BrokerController(_context))
            {
                // Arrange
                var pBrokerId = 1;

                // Act
                var result = broker.DeleteBroker(pBrokerId);

                //Assert
                Assert.IsNotNull(result);
            }
        }
        public SuspendedPullRequestManager(BrokerController brokerController)
        {
            _brokerController = brokerController;
            _scheduleService = ObjectContainer.Resolve<IScheduleService>();
            _messageService = ObjectContainer.Resolve<IMessageService>();

            if (_brokerController.Setting.NotifyWhenMessageArrived)
            {
                _notifyMessageArrivedWorker = new Worker("SuspendedPullRequestManager.NotifyMessageArrived", () =>
                {
                    var notifyItem = _notifyQueue.Take();
                    if (notifyItem == null) return;
                    _queueNotifyOffsetDict[BuildKeyPrefix(notifyItem.Topic, notifyItem.QueueId)] = notifyItem.QueueOffset;
                    NotifyMessageArrived(notifyItem.Topic, notifyItem.QueueId, notifyItem.QueueOffset);
                });
            }
        }
Esempio n. 35
0
 public ClientManager(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _scheduleService = ObjectContainer.Resolve<IScheduleService>();
 }
 public ConsumerHeartbeatRequestHandler(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
 }
 public ConsumerHeartbeatRequestHandler(BrokerController brokerController)
 {
     _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
 }
Esempio n. 38
0
 public ConsumerManager(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _scheduleService = ObjectContainer.Resolve<IScheduleService>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
 }
 public QueryTopicConsumeInfoRequestHandler(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _offsetManager = ObjectContainer.Resolve<IOffsetManager>();
 }