Java Code Examples for org.apache.rocketmq.tools.admin.DefaultMQAdminExt#createTopic()
The following examples show how to use
org.apache.rocketmq.tools.admin.DefaultMQAdminExt#createTopic() .
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: MQAdmin.java From DDMQ with Apache License 2.0 | 6 votes |
public static boolean createTopic(String nameSrvAddr, String clusterName, String topic, int queueNum, int waitTimeSec) { boolean createResult = false; DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt(); mqAdminExt.setNamesrvAddr(nameSrvAddr); try { mqAdminExt.start(); mqAdminExt.createTopic(clusterName, topic, queueNum); } catch (Exception e) { } long startTime = System.currentTimeMillis(); while (!createResult) { createResult = checkTopicExist(mqAdminExt, topic); if (System.currentTimeMillis() - startTime < waitTimeSec * 1000) { TestUtils.waitForMoment(100); } else { log.error(String.format("timeout,but create topic[%s] failed!", topic)); break; } } mqAdminExt.shutdown(); return createResult; }
Example 2
Source File: MQAdmin.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
public static boolean createTopic(String nameSrvAddr, String clusterName, String topic, int queueNum, int waitTimeSec) { boolean createResult = false; DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt(); mqAdminExt.setNamesrvAddr(nameSrvAddr); try { mqAdminExt.start(); mqAdminExt.createTopic(clusterName, topic, queueNum); } catch (Exception e) { } long startTime = System.currentTimeMillis(); while (!createResult) { createResult = checkTopicExist(mqAdminExt, topic); if (System.currentTimeMillis() - startTime < waitTimeSec * 1000) { TestUtils.waitForMoment(100); } else { log.error(String.format("timeout,but create topic[%s] failed!", topic)); break; } } mqAdminExt.shutdown(); return createResult; }
Example 3
Source File: MQAdmin.java From rocketmq-read with Apache License 2.0 | 6 votes |
public static boolean createTopic(String nameSrvAddr, String clusterName, String topic, int queueNum, int waitTimeSec) { boolean createResult = false; DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt(); mqAdminExt.setNamesrvAddr(nameSrvAddr); try { mqAdminExt.start(); mqAdminExt.createTopic(clusterName, topic, queueNum); } catch (Exception e) { } long startTime = System.currentTimeMillis(); while (!createResult) { createResult = checkTopicExist(mqAdminExt, topic); if (System.currentTimeMillis() - startTime < waitTimeSec * 1000) { TestUtils.waitForMoment(100); } else { log.error(String.format("timeout,but create topic[%s] failed!", topic)); break; } } mqAdminExt.shutdown(); return createResult; }
Example 4
Source File: MQAdmin.java From rocketmq with Apache License 2.0 | 6 votes |
public static boolean createTopic(String nameSrvAddr, String clusterName, String topic, int queueNum, int waitTimeSec) { boolean createResult = false; DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt(); mqAdminExt.setNamesrvAddr(nameSrvAddr); try { mqAdminExt.start(); mqAdminExt.createTopic(clusterName, topic, queueNum); } catch (Exception e) { e.printStackTrace(); } long startTime = System.currentTimeMillis(); while (!createResult) { createResult = checkTopicExist(mqAdminExt, topic); if (System.currentTimeMillis() - startTime < waitTimeSec * 1000) { TestUtils.waitForMonment(100); } else { log.error(String.format("timeout,but create topic[%s] failed!", topic)); break; } } mqAdminExt.shutdown(); return createResult; }
Example 5
Source File: MQAdmin.java From DDMQ with Apache License 2.0 | 6 votes |
public static boolean createTopic(String nameSrvAddr, String clusterName, String topic, int queueNum, int waitTimeSec) { boolean createResult = false; DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt(); mqAdminExt.setNamesrvAddr(nameSrvAddr); try { mqAdminExt.start(); mqAdminExt.createTopic(clusterName, topic, queueNum); } catch (Exception e) { } long startTime = System.currentTimeMillis(); while (!createResult) { createResult = checkTopicExist(mqAdminExt, topic); if (System.currentTimeMillis() - startTime < waitTimeSec * 1000) { TestUtils.waitForMoment(100); } else { log.error(String.format("timeout,but create topic[%s] failed!", topic)); break; } } mqAdminExt.shutdown(); return createResult; }
Example 6
Source File: MQAdmin.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
public static boolean createTopic(String nameSrvAddr, String clusterName, String topic, int queueNum, int waitTimeSec) { boolean createResult = false; DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt(); mqAdminExt.setNamesrvAddr(nameSrvAddr); try { mqAdminExt.start(); mqAdminExt.createTopic(clusterName, topic, queueNum); } catch (Exception e) { } long startTime = System.currentTimeMillis(); while (!createResult) { createResult = checkTopicExist(mqAdminExt, topic); if (System.currentTimeMillis() - startTime < waitTimeSec * 1000) { TestUtils.waitForMoment(100); } else { log.error(String.format("timeout,but create topic[%s] failed!", topic)); break; } } mqAdminExt.shutdown(); return createResult; }
Example 7
Source File: MQAdmin.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
public static boolean createTopic(String nameSrvAddr, String clusterName, String topic, int queueNum, int waitTimeSec) { boolean createResult = false; DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt(); mqAdminExt.setNamesrvAddr(nameSrvAddr); try { mqAdminExt.start(); mqAdminExt.createTopic(clusterName, topic, queueNum); } catch (Exception e) { e.printStackTrace(); } long startTime = System.currentTimeMillis(); while (!createResult) { createResult = checkTopicExist(mqAdminExt, topic); if (System.currentTimeMillis() - startTime < waitTimeSec * 1000) { TestUtils.waitForMonment(100); } else { log.error(String.format("timeout,but create topic[%s] failed!", topic)); break; } } mqAdminExt.shutdown(); return createResult; }
Example 8
Source File: MQAdmin.java From rocketmq with Apache License 2.0 | 6 votes |
public static boolean createTopic(String nameSrvAddr, String clusterName, String topic, int queueNum, int waitTimeSec) { boolean createResult = false; DefaultMQAdminExt mqAdminExt = new DefaultMQAdminExt(); mqAdminExt.setInstanceName(UUID.randomUUID().toString()); mqAdminExt.setNamesrvAddr(nameSrvAddr); try { mqAdminExt.start(); mqAdminExt.createTopic(clusterName, topic, queueNum); } catch (Exception e) { } long startTime = System.currentTimeMillis(); while (!createResult) { createResult = checkTopicExist(mqAdminExt, topic); if (System.currentTimeMillis() - startTime < waitTimeSec * 1000) { TestUtils.waitForMoment(100); } else { log.error(String.format("timeout,but create topic[%s] failed!", topic)); break; } } mqAdminExt.shutdown(); return createResult; }