Esempio n. 1
0
 public NameServerController(NameServerSetting setting = null)
 {
     Setting = setting ?? new NameServerSetting();
     ClusterManager = new ClusterManager(this);
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     _socketRemotingServer = new SocketRemotingServer("EQueue.NameServer.RemotingServer", Setting.BindingAddress, Setting.SocketSetting);
     _service = new ConsoleEventHandlerService();
     _service.RegisterClosingEventHandler(eventCode => { Shutdown(); });
     _socketRemotingServer.RegisterConnectionEventListener(new BrokerConnectionEventListener(this));
     RegisterRequestHandlers();
 }
Esempio n. 2
0
 public BrokerController(BrokerSetting setting)
 {
     Setting = setting ?? new BrokerSetting();
     SuspendedPullRequestManager = new SuspendedPullRequestManager();
     ConsumerManager = new ConsumerManager();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().Name);
     _messageService = ObjectContainer.Resolve<IMessageService>();
     _producerSocketRemotingServer = new SocketRemotingServer("ProducerRemotingServer", Setting.ProducerSocketSetting, new ProducerSocketEventListener(this));
     _consumerSocketRemotingServer = new SocketRemotingServer("ConsumerRemotingServer", Setting.ConsumerSocketSetting, new ConsumerSocketEventListener(this));
     _clientManager = new ClientManager(this);
 }
Esempio n. 3
0
 public CommandResultProcessor(IPEndPoint bindingAddress)
 {
     _remotingServer = new SocketRemotingServer("CommandResultProcessor.RemotingServer", bindingAddress);
     _commandTaskDict = new ConcurrentDictionary<string, CommandTaskCompletionSource>();
     _commandExecutedMessageLocalQueue = new BlockingCollection<CommandResult>(new ConcurrentQueue<CommandResult>());
     _domainEventHandledMessageLocalQueue = new BlockingCollection<DomainEventHandledMessage>(new ConcurrentQueue<DomainEventHandledMessage>());
     _commandExecutedMessageWorker = new Worker("ProcessExecutedCommandMessage", () => ProcessExecutedCommandMessage(_commandExecutedMessageLocalQueue.Take()));
     _domainEventHandledMessageWorker = new Worker("ProcessDomainEventHandledMessage", () => ProcessDomainEventHandledMessage(_domainEventHandledMessageLocalQueue.Take()));
     _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     BindingAddress = bindingAddress;
 }
Esempio n. 4
0
 private BrokerController(BrokerSetting setting)
 {
     Setting = setting ?? new BrokerSetting();
     _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
     _messageStore = ObjectContainer.Resolve<IMessageStore>();
     _offsetManager = ObjectContainer.Resolve<IOffsetManager>();
     _queueService = ObjectContainer.Resolve<IQueueService>();
     _messageService = ObjectContainer.Resolve<IMessageService>();
     _suspendedPullRequestManager = ObjectContainer.Resolve<SuspendedPullRequestManager>();
     _producerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ProducerRemotingServer", Setting.ProducerIPEndPoint);
     _consumerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ConsumerRemotingServer", Setting.ConsumerIPEndPoint, this);
     _adminSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.AdminRemotingServer", Setting.AdminIPEndPoint);
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     RegisterRequestHandlers();
 }
Esempio n. 5
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(); });
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            var socketBufferSize = int.Parse(ConfigurationManager.AppSettings["SocketBufferSize"]);
            var setting = new Setting
            {
                TcpConfiguration = new TcpConfiguration
                {
                    SocketBufferSize = socketBufferSize
                }
            };
            ECommonConfiguration
                .Create()
                .UseAutofac()
                .RegisterCommonComponents()
                .UseLog4Net()
                .RegisterUnhandledExceptionHandler();

            var bindingIP = ConfigurationManager.AppSettings["BindingAddress"];
            var serverIP = string.IsNullOrEmpty(bindingIP) ? SocketUtils.GetLocalIPV4() : IPAddress.Parse(bindingIP);
            var server = new SocketRemotingServer("Server", new IPEndPoint(serverIP, 5000));
            server.RegisterRequestHandler(100, new RequestHandler());
            server.Start();
            Console.ReadLine();
        }