use of org.apache.rocketmq.store.config.MessageStoreConfig in project rocketmq-externals by apache.
the class RocketMQLocalCluster method startBroker.
private void startBroker() throws Exception {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
BrokerConfig brokerConfig = new BrokerConfig();
brokerConfig.setNamesrvAddr(nameserverAddr);
brokerConfig.setBrokerId(MixAll.MASTER_ID);
NettyServerConfig nettyServerConfig = new NettyServerConfig();
nettyServerConfig.setListenPort(10911);
NettyClientConfig nettyClientConfig = new NettyClientConfig();
MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, messageStoreConfig);
boolean initResult = brokerController.initialize();
if (!initResult) {
brokerController.shutdown();
throw new Exception("Broker init failure!");
}
brokerController.start();
}
use of org.apache.rocketmq.store.config.MessageStoreConfig in project ignite by apache.
the class TestRocketMQServer method startBroker.
/**
* Starts a test broker.
*
* @throws Exception If fails.
*/
private void startBroker() throws Exception {
BrokerConfig brokerCfg = new BrokerConfig();
NettyServerConfig nettySrvCfg = new NettyServerConfig();
MessageStoreConfig storeCfg = new MessageStoreConfig();
brokerCfg.setBrokerName(TEST_BROKER);
brokerCfg.setBrokerClusterName(TEST_CLUSTER);
brokerCfg.setBrokerIP1(TEST_IP);
brokerCfg.setNamesrvAddr(TEST_IP + ":" + NAME_SERVER_PORT);
storeCfg.setStorePathRootDir(System.getProperty("java.io.tmpdir") + separator + "store-" + UUID.randomUUID());
storeCfg.setStorePathCommitLog(System.getProperty("java.io.tmpdir") + separator + "commitlog");
storeCfg.setHaListenPort(HA_PORT);
nettySrvCfg.setListenPort(BROKER_PORT);
broker = new BrokerController(brokerCfg, nettySrvCfg, new NettyClientConfig(), storeCfg);
broker.initialize();
broker.start();
log.info("Started broker [" + TEST_BROKER + "] at " + BROKER_PORT);
}
use of org.apache.rocketmq.store.config.MessageStoreConfig in project rocketmq-externals by apache.
the class RocketMQServerMock method startBroker.
private void startBroker() throws Exception {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
BrokerConfig brokerConfig = new BrokerConfig();
brokerConfig.setNamesrvAddr(getNameServerAddr());
brokerConfig.setBrokerId(MixAll.MASTER_ID);
NettyServerConfig nettyServerConfig = new NettyServerConfig();
nettyServerConfig.setListenPort(brokerPort);
NettyClientConfig nettyClientConfig = new NettyClientConfig();
MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, messageStoreConfig);
boolean initResult = brokerController.initialize();
if (!initResult) {
brokerController.shutdown();
throw new Exception("Broker init failure!");
}
brokerController.start();
}
use of org.apache.rocketmq.store.config.MessageStoreConfig in project rocketmq-externals by apache.
the class IntegrationTestBase method createAndStartBroker.
public static BrokerController createAndStartBroker(String nsAddr) {
String baseDir = createBaseDir();
BrokerConfig brokerConfig = new BrokerConfig();
NettyServerConfig nettyServerConfig = new NettyServerConfig();
NettyClientConfig nettyClientConfig = new NettyClientConfig();
MessageStoreConfig storeConfig = new MessageStoreConfig();
brokerConfig.setBrokerName(BROKER_NAME_PREFIX + BROKER_INDEX.getAndIncrement());
brokerConfig.setBrokerIP1("127.0.0.1");
brokerConfig.setNamesrvAddr(nsAddr);
brokerConfig.setEnablePropertyFilter(true);
storeConfig.setStorePathRootDir(baseDir);
storeConfig.setStorePathCommitLog(baseDir + SEP + "commitlog");
storeConfig.setHaListenPort(8000 + random.nextInt(1000));
storeConfig.setMapedFileSizeCommitLog(COMMIT_LOG_SIZE);
storeConfig.setMaxIndexNum(INDEX_NUM);
storeConfig.setMaxHashSlotNum(INDEX_NUM * 4);
nettyServerConfig.setListenPort(10000 + random.nextInt(1000));
BrokerController brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, storeConfig);
try {
Assert.assertTrue(brokerController.initialize());
logger.info("Broker Start name:{} addr:{}", brokerConfig.getBrokerName(), brokerController.getBrokerAddr());
brokerController.start();
} catch (Exception e) {
logger.info("Broker start failed");
System.exit(1);
}
BROKER_CONTROLLERS.add(brokerController);
return brokerController;
}
use of org.apache.rocketmq.store.config.MessageStoreConfig in project rocketmq by apache.
the class MessageStoreWithFilterTest method gen.
protected DefaultMessageStore gen(ConsumerFilterManager filterManager) throws Exception {
MessageStoreConfig messageStoreConfig = buildStoreConfig(commitLogFileSize, cqFileSize, true, cqExtFileSize);
BrokerConfig brokerConfig = new BrokerConfig();
brokerConfig.setEnableCalcFilterBitMap(true);
brokerConfig.setMaxErrorRateOfBloomFilter(20);
brokerConfig.setExpectConsumerNumUseFilter(64);
DefaultMessageStore master = new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager(brokerConfig.getBrokerClusterName()), new MessageArrivingListener() {
@Override
public void arriving(String topic, int queueId, long logicOffset, long tagsCode, long msgStoreTime, byte[] filterBitMap, Map<String, String> properties) {
}
}, brokerConfig);
master.getDispatcherList().addFirst(new CommitLogDispatcher() {
@Override
public void dispatch(DispatchRequest request) {
try {
} catch (Throwable e) {
e.printStackTrace();
}
}
});
master.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(brokerConfig, filterManager));
assertThat(master.load()).isTrue();
master.start();
return master;
}
Aggregations