Пример #1
0
        private BrokerController(BrokerSetting setting)
        {
            Setting = setting ?? new BrokerSetting();

            Setting.BrokerInfo.Valid();
            if (Setting.NameServerList == null || Setting.NameServerList.Count() == 0)
            {
                throw new ArgumentException("NameServerList is empty.");
            }

            _latestMessageIds               = new string[Setting.LatestMessageShowCount];
            _producerManager                = ObjectContainer.Resolve <ProducerManager>();
            _consumerManager                = ObjectContainer.Resolve <ConsumerManager>();
            _messageStore                   = ObjectContainer.Resolve <IMessageStore>();
            _consumeOffsetStore             = ObjectContainer.Resolve <IConsumeOffsetStore>();
            _queueStore                     = ObjectContainer.Resolve <IQueueStore>();
            _getTopicConsumeInfoListService = ObjectContainer.Resolve <GetTopicConsumeInfoListService>();
            _getConsumerListService         = ObjectContainer.Resolve <GetConsumerListService>();
            _scheduleService                = ObjectContainer.Resolve <IScheduleService>();
            _binarySerializer               = ObjectContainer.Resolve <IBinarySerializer>();
            _suspendedPullRequestManager    = ObjectContainer.Resolve <SuspendedPullRequestManager>();
            _chunkReadStatisticService      = ObjectContainer.Resolve <IChunkStatisticService>();
            _tpsStatisticService            = ObjectContainer.Resolve <ITpsStatisticService>();

            _producerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ProducerRemotingServer", Setting.BrokerInfo.ProducerAddress.ToEndPoint(), Setting.SocketSetting);
            _consumerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ConsumerRemotingServer", Setting.BrokerInfo.ConsumerAddress.ToEndPoint(), Setting.SocketSetting);
            _adminSocketRemotingServer    = new SocketRemotingServer("EQueue.Broker.AdminRemotingServer", Setting.BrokerInfo.AdminAddress.ToEndPoint(), Setting.SocketSetting);

            _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
            _producerSocketRemotingServer.RegisterConnectionEventListener(new ProducerConnectionEventListener(this));
            _consumerSocketRemotingServer.RegisterConnectionEventListener(new ConsumerConnectionEventListener(this));
            RegisterRequestHandlers();
            _nameServerRemotingClientList = Setting.NameServerList.ToRemotingClientList(Setting.SocketSetting).ToList();
        }
Пример #2
0
        private BrokerController(BrokerSetting setting)
        {
            Setting = setting ?? new BrokerSetting();
            _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
            _messageStore = ObjectContainer.Resolve<IMessageStore>();
            _consumeOffsetStore = ObjectContainer.Resolve<IConsumeOffsetStore>();
            _queueStore = ObjectContainer.Resolve<IQueueStore>();
            _suspendedPullRequestManager = ObjectContainer.Resolve<SuspendedPullRequestManager>();
            _chunkReadStatisticService = ObjectContainer.Resolve<IChunkStatisticService>();

            _producerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ProducerRemotingServer", Setting.ProducerAddress, Setting.SocketSetting);
            _consumerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ConsumerRemotingServer", Setting.ConsumerAddress, Setting.SocketSetting);
            _adminSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.AdminRemotingServer", Setting.AdminAddress, Setting.SocketSetting);

            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
            _consumerSocketRemotingServer.RegisterConnectionEventListener(new ConsumerConnectionEventListener(this));
            RegisterRequestHandlers();

            _service = new ConsoleEventHandlerService();
            _service.RegisterClosingEventHandler(eventCode => { Shutdown(); });
        }
Пример #3
0
        private BrokerController(BrokerSetting setting)
        {
            Setting                      = setting ?? new BrokerSetting();
            _consumerManager             = ObjectContainer.Resolve <ConsumerManager>();
            _messageStore                = ObjectContainer.Resolve <IMessageStore>();
            _consumeOffsetStore          = ObjectContainer.Resolve <IConsumeOffsetStore>();
            _queueStore                  = ObjectContainer.Resolve <IQueueStore>();
            _suspendedPullRequestManager = ObjectContainer.Resolve <SuspendedPullRequestManager>();
            _chunkReadStatisticService   = ObjectContainer.Resolve <IChunkStatisticService>();

            _producerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ProducerRemotingServer", Setting.ProducerAddress, Setting.SocketSetting);
            _consumerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ConsumerRemotingServer", Setting.ConsumerAddress, Setting.SocketSetting);
            _adminSocketRemotingServer    = new SocketRemotingServer("EQueue.Broker.AdminRemotingServer", Setting.AdminAddress, Setting.SocketSetting);

            _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
            _consumerSocketRemotingServer.RegisterConnectionEventListener(new ConsumerConnectionEventListener(this));
            RegisterRequestHandlers();

            _service = new ConsoleEventHandlerService();
            _service.RegisterClosingEventHandler(eventCode => { Shutdown(); });
        }