com.alibaba.rocketmq.remoting.netty.NettyServerConfig Java Examples
The following examples show how to use
com.alibaba.rocketmq.remoting.netty.NettyServerConfig.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TopicConfigManagerTest.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
@Test public void test_flushTopicConfig() throws Exception { BrokerController brokerController = new BrokerController(// new BrokerConfig(), // new NettyServerConfig(), // new NettyClientConfig(), // new MessageStoreConfig()); boolean initResult = brokerController.initialize(); System.out.println("initialize " + initResult); brokerController.start(); TopicConfigManager topicConfigManager = new TopicConfigManager(brokerController); TopicConfig topicConfig = topicConfigManager.createTopicInSendMessageMethod("TestTopic_SEND", MixAll.DEFAULT_TOPIC, null, 4, 0); assertTrue(topicConfig != null); System.out.println(topicConfig); for (int i = 0; i < 10; i++) { String topic = "UNITTEST-" + i; topicConfig = topicConfigManager .createTopicInSendMessageMethod(topic, MixAll.DEFAULT_TOPIC, null, 4, 0); assertTrue(topicConfig != null); } topicConfigManager.persist(); brokerController.shutdown(); }
Example #2
Source File: NamesrvController.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
public NamesrvController(NamesrvConfig namesrvConfig, NettyServerConfig nettyServerConfig) { this.namesrvConfig = namesrvConfig; this.nettyServerConfig = nettyServerConfig; this.kvConfigManager = new KVConfigManager(this); this.routeInfoManager = new RouteInfoManager(); this.brokerHousekeepingService = new BrokerHousekeepingService(this); }
Example #3
Source File: TopicConfigManagerTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void test_flushTopicConfig() throws Exception { BrokerController brokerController = new BrokerController(// new BrokerConfig(), // new NettyServerConfig(), // new NettyClientConfig(), // new MessageStoreConfig()); boolean initResult = brokerController.initialize(); System.out.println("initialize " + initResult); brokerController.start(); TopicConfigManager topicConfigManager = new TopicConfigManager(brokerController); TopicConfig topicConfig = topicConfigManager.createTopicInSendMessageMethod("TestTopic_SEND", MixAll.DEFAULT_TOPIC, null, 4, 0); assertTrue(topicConfig != null); System.out.println(topicConfig); for (int i = 0; i < 10; i++) { String topic = "UNITTEST-" + i; topicConfig = topicConfigManager .createTopicInSendMessageMethod(topic, MixAll.DEFAULT_TOPIC, null, 4, 0); assertTrue(topicConfig != null); } topicConfigManager.persist(); brokerController.shutdown(); }
Example #4
Source File: ConsumerOffsetManagerTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void test_flushConsumerOffset() throws Exception { BrokerController brokerController = new BrokerController(// new BrokerConfig(), // new NettyServerConfig(), // new NettyClientConfig(), // new MessageStoreConfig()); boolean initResult = brokerController.initialize(); System.out.println("initialize " + initResult); brokerController.start(); ConsumerOffsetManager consumerOffsetManager = new ConsumerOffsetManager(brokerController); Random random = new Random(); for (int i = 0; i < 100; i++) { String group = "DIANPU_GROUP_" + i; for (int id = 0; id < 16; id++) { consumerOffsetManager.commitOffset(null, group, "TOPIC_A", id, random.nextLong() % 1024 * 1024 * 1024); consumerOffsetManager.commitOffset(null, group, "TOPIC_B", id, random.nextLong() % 1024 * 1024 * 1024); consumerOffsetManager.commitOffset(null, group, "TOPIC_C", id, random.nextLong() % 1024 * 1024 * 1024); } } consumerOffsetManager.persist(); brokerController.shutdown(); }
Example #5
Source File: NamesrvController.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public NamesrvController(NamesrvConfig namesrvConfig, NettyServerConfig nettyServerConfig) { this.namesrvConfig = namesrvConfig; this.nettyServerConfig = nettyServerConfig; this.kvConfigManager = new KVConfigManager(this); this.routeInfoManager = new RouteInfoManager(); this.brokerHousekeepingService = new BrokerHousekeepingService(this); }
Example #6
Source File: NamesrvController.java From rocketmq with Apache License 2.0 | 5 votes |
public NamesrvController(NamesrvConfig namesrvConfig, NettyServerConfig nettyServerConfig) { this.namesrvConfig = namesrvConfig; this.nettyServerConfig = nettyServerConfig; this.kvConfigManager = new KVConfigManager(this); this.routeInfoManager = new RouteInfoManager(); this.brokerHousekeepingService = new BrokerHousekeepingService(this); }
Example #7
Source File: BrokerController.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
public BrokerController(final BrokerConfig brokerConfig, final NettyServerConfig nettyServerConfig, final NettyClientConfig nettyClientConfig, final MessageStoreConfig messageStoreConfig) { this.brokerConfig = brokerConfig; this.nettyServerConfig = nettyServerConfig; this.nettyClientConfig = nettyClientConfig; this.messageStoreConfig = messageStoreConfig; this.consumerOffsetManager = new ConsumerOffsetManager(this); this.topicConfigManager = new TopicConfigManager(this); this.pullMessageProcessor = new PullMessageProcessor(this); this.pullRequestHoldService = new PullRequestHoldService(this); this.consumerIdsChangeListener = new DefaultConsumerIdsChangeListener(this); this.consumerManager = new ConsumerManager(this.consumerIdsChangeListener); this.producerManager = new ProducerManager(); this.clientHousekeepingService = new ClientHousekeepingService(this); this.broker2Client = new Broker2Client(this); this.subscriptionGroupManager = new SubscriptionGroupManager(this); this.brokerOuterAPI = new BrokerOuterAPI(nettyClientConfig); this.filterServerManager = new FilterServerManager(this); if (this.brokerConfig.getNamesrvAddr() != null) { // 更新netty client 的nameserver地址 this.brokerOuterAPI.updateNameServerAddressList(this.brokerConfig.getNamesrvAddr()); log.info("user specfied name server address: {}", this.brokerConfig.getNamesrvAddr()); } // 构造broker和broker slave 节点间数据同步的对象 this.slaveSynchronize = new SlaveSynchronize(this); // 发送消息任务队列 this.sendThreadPoolQueue = new LinkedBlockingQueue<Runnable>(this.brokerConfig.getSendThreadPoolQueueCapacity()); // 拉取消息任务队列 this.pullThreadPoolQueue = new LinkedBlockingQueue<Runnable>(this.brokerConfig.getPullThreadPoolQueueCapacity()); // 初始化broker状态管理类 this.brokerStatsManager = new BrokerStatsManager(this.brokerConfig.getBrokerClusterName()); // 设置broker IP和端口 this.setStoreHost(new InetSocketAddress(this.getBrokerConfig().getBrokerIP1(), this.getNettyServerConfig().getListenPort())); }
Example #8
Source File: ConsumerOffsetManagerTest.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
@Test public void test_flushConsumerOffset() throws Exception { BrokerController brokerController = new BrokerController(// new BrokerConfig(), // new NettyServerConfig(), // new NettyClientConfig(), // new MessageStoreConfig()); boolean initResult = brokerController.initialize(); System.out.println("initialize " + initResult); brokerController.start(); ConsumerOffsetManager consumerOffsetManager = new ConsumerOffsetManager(brokerController); Random random = new Random(); for (int i = 0; i < 100; i++) { String group = "DIANPU_GROUP_" + i; for (int id = 0; id < 16; id++) { consumerOffsetManager.commitOffset(group, "TOPIC_A", id, random.nextLong() % 1024 * 1024 * 1024); consumerOffsetManager.commitOffset(group, "TOPIC_B", id, random.nextLong() % 1024 * 1024 * 1024); consumerOffsetManager.commitOffset(group, "TOPIC_C", id, random.nextLong() % 1024 * 1024 * 1024); } } consumerOffsetManager.persist(); brokerController.shutdown(); }
Example #9
Source File: BrokerController.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public BrokerController(// final BrokerConfig brokerConfig, // final NettyServerConfig nettyServerConfig, // final NettyClientConfig nettyClientConfig, // final MessageStoreConfig messageStoreConfig // ) { this.brokerConfig = brokerConfig; this.nettyServerConfig = nettyServerConfig; this.nettyClientConfig = nettyClientConfig; this.messageStoreConfig = messageStoreConfig; this.consumerOffsetManager = new ConsumerOffsetManager(this); this.topicConfigManager = new TopicConfigManager(this); this.pullMessageProcessor = new PullMessageProcessor(this); this.pullRequestHoldService = new PullRequestHoldService(this); this.messageArrivingListener = new NotifyMessageArrivingListener(this.pullRequestHoldService); this.consumerIdsChangeListener = new DefaultConsumerIdsChangeListener(this); this.consumerManager = new ConsumerManager(this.consumerIdsChangeListener); this.producerManager = new ProducerManager(); this.clientHousekeepingService = new ClientHousekeepingService(this); this.broker2Client = new Broker2Client(this); this.subscriptionGroupManager = new SubscriptionGroupManager(this); this.brokerOuterAPI = new BrokerOuterAPI(nettyClientConfig); this.filterServerManager = new FilterServerManager(this); if (this.brokerConfig.getNamesrvAddr() != null) { this.brokerOuterAPI.updateNameServerAddressList(this.brokerConfig.getNamesrvAddr()); log.info("user specfied name server address: {}", this.brokerConfig.getNamesrvAddr()); } this.slaveSynchronize = new SlaveSynchronize(this); this.sendThreadPoolQueue = new LinkedBlockingQueue<Runnable>(this.brokerConfig.getSendThreadPoolQueueCapacity()); this.pullThreadPoolQueue = new LinkedBlockingQueue<Runnable>(this.brokerConfig.getPullThreadPoolQueueCapacity()); this.brokerStatsManager = new BrokerStatsManager(this.brokerConfig.getBrokerClusterName()); this.setStoreHost(new InetSocketAddress(this.getBrokerConfig().getBrokerIP1(), this.getNettyServerConfig().getListenPort())); }
Example #10
Source File: ConsumerOffsetManagerTest.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
@Test public void test_flushConsumerOffset() throws Exception { BrokerController brokerController = new BrokerController(// new BrokerConfig(), // new NettyServerConfig(), // new NettyClientConfig(), // new MessageStoreConfig()); boolean initResult = brokerController.initialize(); System.out.println("initialize " + initResult); brokerController.start(); ConsumerOffsetManager consumerOffsetManager = new ConsumerOffsetManager(brokerController); Random random = new Random(); for (int i = 0; i < 100; i++) { String group = "DIANPU_GROUP_" + i; for (int id = 0; id < 16; id++) { consumerOffsetManager.commitOffset(group, "TOPIC_A", id, random.nextLong() % 1024 * 1024 * 1024); consumerOffsetManager.commitOffset(group, "TOPIC_B", id, random.nextLong() % 1024 * 1024 * 1024); consumerOffsetManager.commitOffset(group, "TOPIC_C", id, random.nextLong() % 1024 * 1024 * 1024); } } consumerOffsetManager.persist(); brokerController.shutdown(); }
Example #11
Source File: TopicConfigManagerTest.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
@Test public void test_flushTopicConfig() throws Exception { BrokerController brokerController = new BrokerController(// new BrokerConfig(), // new NettyServerConfig(), // new NettyClientConfig(), // new MessageStoreConfig()); boolean initResult = brokerController.initialize(); System.out.println("initialize " + initResult); brokerController.start(); TopicConfigManager topicConfigManager = new TopicConfigManager(brokerController); TopicConfig topicConfig = topicConfigManager.createTopicInSendMessageMethod("TestTopic_SEND", MixAll.DEFAULT_TOPIC, null, 4, 0); assertTrue(topicConfig != null); System.out.println(topicConfig); for (int i = 0; i < 10; i++) { String topic = "UNITTEST-" + i; topicConfig = topicConfigManager.createTopicInSendMessageMethod(topic, MixAll.DEFAULT_TOPIC, null, 4, 0); assertTrue(topicConfig != null); } topicConfigManager.persist(); brokerController.shutdown(); }
Example #12
Source File: FiltersrvController.java From rocketmq with Apache License 2.0 | 4 votes |
public NettyServerConfig getNettyServerConfig() { return nettyServerConfig; }
Example #13
Source File: BrokerController.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public NettyServerConfig getNettyServerConfig() { return nettyServerConfig; }
Example #14
Source File: FiltersrvController.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public NettyServerConfig getNettyServerConfig() { return nettyServerConfig; }
Example #15
Source File: FiltersrvController.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public FiltersrvController(FiltersrvConfig filtersrvConfig, NettyServerConfig nettyServerConfig) { this.filtersrvConfig = filtersrvConfig; this.nettyServerConfig = nettyServerConfig; this.filterClassManager = new FilterClassManager(this); }
Example #16
Source File: NamesrvController.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public NettyServerConfig getNettyServerConfig() { return nettyServerConfig; }
Example #17
Source File: SendMessageTest.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
@Test public void test_sendMessage() throws Exception { BrokerController brokerController = new BrokerController(// new BrokerConfig(), // new NettyServerConfig(), // new NettyClientConfig(), // new MessageStoreConfig()); boolean initResult = brokerController.initialize(); System.out.println("initialize " + initResult); brokerController.start(); MQClientAPIImpl client = new MQClientAPIImpl(new NettyClientConfig(), null); client.start(); for (int i = 0; i < 100000; i++) { String topic = "UnitTestTopic_" + i % 3; Message msg = new Message(topic, "TAG1 TAG2", "100200300", ("Hello, Nice world\t" + i).getBytes()); msg.setDelayTimeLevel(i % 3 + 1); try { SendMessageRequestHeader requestHeader = new SendMessageRequestHeader(); requestHeader.setProducerGroup("abc"); requestHeader.setTopic(msg.getTopic()); requestHeader.setDefaultTopic(MixAll.DEFAULT_TOPIC); requestHeader.setDefaultTopicQueueNums(4); requestHeader.setQueueId(i % 4); requestHeader.setSysFlag(0); requestHeader.setBornTimestamp(System.currentTimeMillis()); requestHeader.setFlag(msg.getFlag()); requestHeader.setProperties(MessageDecoder.messageProperties2String(msg.getProperties())); SendResult result = client.sendMessage("127.0.0.1:10911", "brokerName", msg, requestHeader, 1000 * 5, CommunicationMode.SYNC, null); System.out.println(i + "\t" + result); } catch (Exception e) { e.printStackTrace(); } } client.shutdown(); brokerController.shutdown(); }
Example #18
Source File: SendMessageTest.java From rocketmq with Apache License 2.0 | 4 votes |
@Test public void test_sendMessage() throws Exception { BrokerController brokerController = new BrokerController(// new BrokerConfig(), // new NettyServerConfig(), // new NettyClientConfig(), // new MessageStoreConfig()); boolean initResult = brokerController.initialize(); System.out.println("initialize " + initResult); brokerController.start(); MQClientAPIImpl client = new MQClientAPIImpl(new NettyClientConfig(), null, null, null); client.start(); for (int i = 0; i < 100000; i++) { String topic = "UnitTestTopic_" + i % 3; Message msg = new Message(topic, "TAG1 TAG2", "100200300", ("Hello, Nice world\t" + i).getBytes()); msg.setDelayTimeLevel(i % 3 + 1); try { SendMessageRequestHeader requestHeader = new SendMessageRequestHeader(); requestHeader.setProducerGroup("abc"); requestHeader.setTopic(msg.getTopic()); requestHeader.setDefaultTopic(MixAll.DEFAULT_TOPIC); requestHeader.setDefaultTopicQueueNums(4); requestHeader.setQueueId(i % 4); requestHeader.setSysFlag(0); requestHeader.setBornTimestamp(System.currentTimeMillis()); requestHeader.setFlag(msg.getFlag()); requestHeader.setProperties(MessageDecoder.messageProperties2String(msg.getProperties())); SendResult result = client.sendMessage("127.0.0.1:10911", "brokerName", msg, requestHeader, 1000 * 5, CommunicationMode.SYNC, new SendMessageContext(), null); System.out.println(i + "\t" + result); } catch (Exception e) { e.printStackTrace(); } } client.shutdown(); brokerController.shutdown(); }
Example #19
Source File: FiltersrvController.java From rocketmq with Apache License 2.0 | 4 votes |
public FiltersrvController(FiltersrvConfig filtersrvConfig, NettyServerConfig nettyServerConfig) { this.filtersrvConfig = filtersrvConfig; this.nettyServerConfig = nettyServerConfig; this.filterClassManager = new FilterClassManager(this); }
Example #20
Source File: NamesrvController.java From rocketmq with Apache License 2.0 | 4 votes |
public NettyServerConfig getNettyServerConfig() { return nettyServerConfig; }
Example #21
Source File: SendMessageTest.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
@Test public void test_sendMessage() throws Exception { BrokerController brokerController = new BrokerController(// new BrokerConfig(), // new NettyServerConfig(), // new NettyClientConfig(), // new MessageStoreConfig()); boolean initResult = brokerController.initialize(); System.out.println("initialize " + initResult); brokerController.start(); MQClientAPIImpl client = new MQClientAPIImpl(new NettyClientConfig(), null, null, null); client.start(); for (int i = 0; i < 100000; i++) { String topic = "UnitTestTopic_" + i % 3; Message msg = new Message(topic, "TAG1 TAG2", "100200300", ("Hello, Nice world\t" + i).getBytes()); msg.setDelayTimeLevel(i % 3 + 1); try { SendMessageRequestHeader requestHeader = new SendMessageRequestHeader(); requestHeader.setProducerGroup("abc"); requestHeader.setTopic(msg.getTopic()); requestHeader.setDefaultTopic(MixAll.DEFAULT_TOPIC); requestHeader.setDefaultTopicQueueNums(4); requestHeader.setQueueId(i % 4); requestHeader.setSysFlag(0); requestHeader.setBornTimestamp(System.currentTimeMillis()); requestHeader.setFlag(msg.getFlag()); requestHeader.setProperties(MessageDecoder.messageProperties2String(msg.getProperties())); SendResult result = client.sendMessage("127.0.0.1:10911", "brokerName", msg, requestHeader, 1000 * 5, CommunicationMode.SYNC, null); System.out.println(i + "\t" + result); } catch (Exception e) { e.printStackTrace(); } } client.shutdown(); brokerController.shutdown(); }
Example #22
Source File: BrokerController.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
public NettyServerConfig getNettyServerConfig() { return nettyServerConfig; }
Example #23
Source File: FiltersrvController.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
public NettyServerConfig getNettyServerConfig() { return nettyServerConfig; }
Example #24
Source File: FiltersrvController.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
public FiltersrvController(FiltersrvConfig filtersrvConfig, NettyServerConfig nettyServerConfig) { this.filtersrvConfig = filtersrvConfig; this.nettyServerConfig = nettyServerConfig; this.filterClassManager = new FilterClassManager(this); }
Example #25
Source File: NamesrvController.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
public NettyServerConfig getNettyServerConfig() { return nettyServerConfig; }