use of org.apache.rocketmq.remoting.netty.NettyServerConfig in project rocketmq-externals by apache.
the class RocketMQSourceTest method startNamesrv.
/**
* This method starts the RocketMQ nameserver.
*
* @throws Exception
*/
private static void startNamesrv() throws Exception {
NamesrvConfig namesrvConfig = new NamesrvConfig();
NettyServerConfig nettyServerConfig = new NettyServerConfig();
nettyServerConfig.setListenPort(9876);
namesrvController = new NamesrvController(namesrvConfig, nettyServerConfig);
boolean initResult = namesrvController.initialize();
if (!initResult) {
namesrvController.shutdown();
throw new Exception("Name server controller failed to initialize.");
}
namesrvController.start();
}
use of org.apache.rocketmq.remoting.netty.NettyServerConfig in project rocketmq-externals by apache.
the class RocketMQSourceTest method startBroker.
/**
* This method starts the RocketMQ broker.
*
* @throws Exception
*/
private static void startBroker() throws Exception {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
BrokerConfig brokerConfig = new BrokerConfig();
brokerConfig.setNamesrvAddr(NAMESERVER);
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();
}
brokerController.start();
}
use of org.apache.rocketmq.remoting.netty.NettyServerConfig in project rocketmq-externals by apache.
the class IntegrationTestBase method createAndStartNamesrv.
public static NamesrvController createAndStartNamesrv() {
String baseDir = createBaseDir();
NamesrvConfig namesrvConfig = new NamesrvConfig();
NettyServerConfig nameServerNettyServerConfig = new NettyServerConfig();
namesrvConfig.setKvConfigPath(baseDir + SEP + "namesrv" + SEP + "kvConfig.json");
nameServerNettyServerConfig.setListenPort(9000 + random.nextInt(1000));
NamesrvController namesrvController = new NamesrvController(namesrvConfig, nameServerNettyServerConfig);
try {
Assert.assertTrue(namesrvController.initialize());
logger.info("Name Server Start:{}", nameServerNettyServerConfig.getListenPort());
namesrvController.start();
} catch (Exception e) {
System.out.println("Name Server start failed");
System.exit(1);
}
NAMESRV_CONTROLLERS.add(namesrvController);
return namesrvController;
}
use of org.apache.rocketmq.remoting.netty.NettyServerConfig 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);
storeConfig.setStorePathRootDir(baseDir);
storeConfig.setStorePathCommitLog(baseDir + SEP + "commitlog");
storeConfig.setHaListenPort(8000 + random.nextInt(1000));
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) {
System.out.println("Broker start failed");
System.exit(1);
}
BROKER_CONTROLLERS.add(brokerController);
return brokerController;
}
use of org.apache.rocketmq.remoting.netty.NettyServerConfig in project rocketmq-externals by apache.
the class IntegrationTestBase method createAndStartNamesrv.
public static NamesrvController createAndStartNamesrv() {
String baseDir = createBaseDir();
NamesrvConfig namesrvConfig = new NamesrvConfig();
NettyServerConfig nameServerNettyServerConfig = new NettyServerConfig();
namesrvConfig.setKvConfigPath(baseDir + SEP + "namesrv" + SEP + "kvConfig.json");
namesrvConfig.setConfigStorePath(baseDir + SEP + "namesrv" + SEP + "namesrv.properties");
nameServerNettyServerConfig.setListenPort(9000 + random.nextInt(1000));
NamesrvController namesrvController = new NamesrvController(namesrvConfig, nameServerNettyServerConfig);
try {
Assert.assertTrue(namesrvController.initialize());
logger.info("Name Server Start:{}", nameServerNettyServerConfig.getListenPort());
namesrvController.start();
} catch (Exception e) {
logger.info("Name Server start failed");
System.exit(1);
}
NAMESRV_CONTROLLERS.add(namesrvController);
return namesrvController;
}
Aggregations