com.alibaba.rocketmq.tools.command.topic.DeleteTopicSubCommand Java Examples
The following examples show how to use
com.alibaba.rocketmq.tools.command.topic.DeleteTopicSubCommand.
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: TopicService.java From rocketmq with Apache License 2.0 | 5 votes |
@CmdTrace(cmdClazz = DeleteTopicSubCommand.class) public boolean delete(String topicName, String clusterName) throws Throwable { Throwable t = null; DefaultMQAdminExt adminExt = getDefaultMQAdminExt(); try { if (StringUtils.isNotBlank(clusterName)) { adminExt.start(); Set<String> masterSet = CommandUtil.fetchMasterAddrByClusterName(adminExt, clusterName); adminExt.deleteTopicInBroker(masterSet, topicName); Set<String> nameServerSet = null; if (StringUtils.isNotBlank(configureInitializer.getNamesrvAddr())) { String[] ns = configureInitializer.getNamesrvAddr().split(";"); nameServerSet = new HashSet<String>(Arrays.asList(ns)); } adminExt.deleteTopicInNameServer(nameServerSet, topicName); return true; } else { throw new IllegalStateException("clusterName is blank"); } } catch (Throwable e) { logger.error(e.getMessage(), e); t = e; } finally { shutdownDefaultMQAdminExt(adminExt); } throw t; }