Example #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();
        }
Example #2
0
 public GetTopicConsumeInfoListService(ConsumerManager consumerManager, IConsumeOffsetStore consumeOffsetStore, IQueueStore queueStore, ITpsStatisticService tpsStatisticService)
 {
     _consumerManager     = consumerManager;
     _consumeOffsetStore  = consumeOffsetStore;
     _queueStore          = queueStore;
     _tpsStatisticService = tpsStatisticService;
 }
 public GetTopicConsumeInfoListService(ConsumerManager consumerManager, IConsumeOffsetStore consumeOffsetStore, IQueueStore queueStore, ITpsStatisticService tpsStatisticService)
 {
     _consumerManager = consumerManager;
     _consumeOffsetStore = consumeOffsetStore;
     _queueStore = queueStore;
     _tpsStatisticService = tpsStatisticService;
 }
Example #4
0
 public DefaultQueueStore(IMessageStore messageStore, IConsumeOffsetStore consumeOffsetStore, IScheduleService scheduleService, ITpsStatisticService tpsStatisticService, ILoggerFactory loggerFactory)
 {
     _queueDict           = new ConcurrentDictionary <QueueKey, Queue>();
     _messageStore        = messageStore;
     _consumeOffsetStore  = consumeOffsetStore;
     _scheduleService     = scheduleService;
     _tpsStatisticService = tpsStatisticService;
     _logger = loggerFactory.Create(GetType().FullName);
 }
 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);
 }
Example #6
0
        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);
        }
 public UpdateQueueConsumeOffsetRequestHandler()
 {
     _offsetStore         = ObjectContainer.Resolve <IConsumeOffsetStore>();
     _binarySerializer    = ObjectContainer.Resolve <IBinarySerializer>();
     _tpsStatisticService = ObjectContainer.Resolve <ITpsStatisticService>();
 }
 public UpdateQueueConsumeOffsetRequestHandler()
 {
     _offsetStore = ObjectContainer.Resolve<IConsumeOffsetStore>();
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _tpsStatisticService = ObjectContainer.Resolve<ITpsStatisticService>();
 }