use of org.apache.rocketmq.common.TopicConfig in project ignite by apache.
the class RocketMQStreamerTest method initTopic.
/**
* Initializes RocketMQ topic.
*
* @param topic Topic.
* @param nsAddr Nameserver address.
* @throws IgniteInterruptedCheckedException If fails.
*/
private void initTopic(String topic, String nsAddr) throws Exception {
DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();
defaultMQAdminExt.setNamesrvAddr(nsAddr);
try {
defaultMQAdminExt.start();
TopicConfig topicConfig = new TopicConfig();
topicConfig.setTopicName(topic);
topicConfig.setReadQueueNums(4);
topicConfig.setWriteQueueNums(4);
defaultMQAdminExt.createAndUpdateTopicConfig(testRocketMQServer.getBrokerAddr(), topicConfig);
U.sleep(100);
} finally {
defaultMQAdminExt.shutdown();
}
}
use of org.apache.rocketmq.common.TopicConfig in project rocketmq-externals by apache.
the class TopicServiceImpl method examineTopicConfig.
@Override
public List<TopicConfigInfo> examineTopicConfig(String topic) {
List<TopicConfigInfo> topicConfigInfoList = Lists.newArrayList();
TopicRouteData topicRouteData = route(topic);
for (BrokerData brokerData : topicRouteData.getBrokerDatas()) {
TopicConfigInfo topicConfigInfo = new TopicConfigInfo();
TopicConfig topicConfig = examineTopicConfig(topic, brokerData.getBrokerName());
BeanUtils.copyProperties(topicConfig, topicConfigInfo);
topicConfigInfo.setBrokerNameList(Lists.newArrayList(brokerData.getBrokerName()));
topicConfigInfoList.add(topicConfigInfo);
}
return topicConfigInfoList;
}
use of org.apache.rocketmq.common.TopicConfig in project rocketmq-externals by apache.
the class TopicServiceImplTest method examineTopicConfigList.
@Test
public void examineTopicConfigList() throws Exception {
TopicConfig topicConfig = topicService.examineTopicConfig(TEST_CONSOLE_TOPIC, TestConstant.TEST_BROKER_NAME);
Assert.assertNotNull(topicConfig);
Assert.assertEquals(topicConfig.getReadQueueNums(), READ_QUEUE_NUM);
Assert.assertEquals(topicConfig.getWriteQueueNums(), WRITE_QUEUE_NUM);
}
use of org.apache.rocketmq.common.TopicConfig in project rocketmq-externals by apache.
the class TopicServiceImpl method createOrUpdate.
@Override
public void createOrUpdate(TopicConfigInfo topicCreateOrUpdateRequest) {
TopicConfig topicConfig = new TopicConfig();
BeanUtils.copyProperties(topicCreateOrUpdateRequest, topicConfig);
try {
ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo();
for (String brokerName : changeToBrokerNameSet(clusterInfo.getClusterAddrTable(), topicCreateOrUpdateRequest.getClusterNameList(), topicCreateOrUpdateRequest.getBrokerNameList())) {
mqAdminExt.createAndUpdateTopicConfig(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), topicConfig);
}
} catch (Exception err) {
throw Throwables.propagate(err);
}
}
use of org.apache.rocketmq.common.TopicConfig in project rocketmq-externals by apache.
the class IntegrationTestBase method createTopic.
public static void createTopic(String topic, String addr) {
TopicConfig topicConfig = new TopicConfig();
topicConfig.setTopicName(topic);
topicConfig.setReadQueueNums(4);
topicConfig.setWriteQueueNums(4);
try {
defaultMQAdminExt.createAndUpdateTopicConfig(addr, topicConfig);
} catch (Exception e) {
logger.error("Create topic:{} addr:{} failed", addr, topic);
}
}
Aggregations