use of org.apache.rocketmq.tools.admin.DefaultMQAdminExt 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.tools.admin.DefaultMQAdminExt in project rocketmq-externals by apache.
the class MQAdminInstance method initMQAdminInstance.
public static void initMQAdminInstance(long timeoutMillis) throws MQClientException {
Integer nowCount = INIT_COUNTER.get();
if (nowCount == null) {
DefaultMQAdminExt defaultMQAdminExt;
if (timeoutMillis > 0) {
defaultMQAdminExt = new DefaultMQAdminExt(timeoutMillis);
} else {
defaultMQAdminExt = new DefaultMQAdminExt();
}
defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
defaultMQAdminExt.start();
MQ_ADMIN_EXT_THREAD_LOCAL.set(defaultMQAdminExt);
INIT_COUNTER.set(1);
} else {
INIT_COUNTER.set(nowCount + 1);
}
}
Aggregations