本文整理汇总了Java中com.alibaba.rocketmq.common.namesrv.NamesrvUtil.NAMESPACE_PROJECT_CONFIG属性的典型用法代码示例。如果您正苦于以下问题:Java NamesrvUtil.NAMESPACE_PROJECT_CONFIG属性的具体用法?Java NamesrvUtil.NAMESPACE_PROJECT_CONFIG怎么用?Java NamesrvUtil.NAMESPACE_PROJECT_CONFIG使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.alibaba.rocketmq.common.namesrv.NamesrvUtil
的用法示例。
在下文中一共展示了NamesrvUtil.NAMESPACE_PROJECT_CONFIG属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateProjectGroup
@CmdTrace(cmdClazz = UpdateProjectGroupCommand.class)
public boolean updateProjectGroup(String ip, String project) throws Throwable {
Throwable t = null;
DefaultMQAdminExt defaultMQAdminExt = getDefaultMQAdminExt();
String namespace = NamesrvUtil.NAMESPACE_PROJECT_CONFIG;
try {
defaultMQAdminExt.start();
defaultMQAdminExt.createAndUpdateKvConfig(namespace, ip, project);
return true;
}
catch (Throwable e) {
logger.error(e.getMessage(), e);
t = e;
}
finally {
shutdownDefaultMQAdminExt(defaultMQAdminExt);
}
throw t;
}
示例2: execute
@Override
public void execute(CommandLine commandLine, Options options) {
DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();
defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
try {
String namespace = NamesrvUtil.NAMESPACE_PROJECT_CONFIG;
String ip = commandLine.getOptionValue('i').trim();
String project = commandLine.getOptionValue('p').trim();
defaultMQAdminExt.start();
defaultMQAdminExt.createAndUpdateKvConfig(namespace, ip, project);
System.out.printf("create or update kv config to namespace success.\n");
return;
}
catch (Exception e) {
e.printStackTrace();
}
finally {
defaultMQAdminExt.shutdown();
}
}
示例3: deleteProjectGroup
@CmdTrace(cmdClazz = DeleteProjectGroupCommand.class)
public boolean deleteProjectGroup(String ip, String project) throws Throwable {
Throwable t = null;
DefaultMQAdminExt defaultMQAdminExt = getDefaultMQAdminExt();
String namespace = NamesrvUtil.NAMESPACE_PROJECT_CONFIG;
try {
if (StringUtils.isNotBlank(ip)) {
defaultMQAdminExt.start();
defaultMQAdminExt.deleteKvConfig(namespace, ip);
return true;
}
else if (StringUtils.isNotBlank(project)) {
defaultMQAdminExt.start();
defaultMQAdminExt.deleteIpsByProjectGroup(project);
return true;
}
else {
throw new IllegalStateException("project or ip can not be all blank!");
}
}
catch (Throwable e) {
logger.error(e.getMessage(), e);
t = e;
}
finally {
shutdownDefaultMQAdminExt(defaultMQAdminExt);
}
throw t;
}
示例4: execute
@Override
public void execute(CommandLine commandLine, Options options) {
DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();
defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
try {
String namespace = NamesrvUtil.NAMESPACE_PROJECT_CONFIG;
if (commandLine.hasOption("i")) {
String ip = commandLine.getOptionValue('i').trim();
defaultMQAdminExt.start();
defaultMQAdminExt.deleteKvConfig(namespace, ip);
System.out.printf("delete project group from namespace by server ip success.\n");
}
else if (commandLine.hasOption("p")) {
String project = commandLine.getOptionValue('p').trim();
defaultMQAdminExt.start();
defaultMQAdminExt.deleteIpsByProjectGroup(project);
System.out.printf("delete all server ip from namespace by project group success.\n");
}
else {
MixAll.printCommandLineHelp("mqadmin " + this.commandName(), options);
}
}
catch (Exception e) {
e.printStackTrace();
}
finally {
defaultMQAdminExt.shutdown();
}
}
示例5: getIpsByProjectGroup
@Override
public String getIpsByProjectGroup(String projectGroup) throws RemotingException, MQBrokerException,
InterruptedException, MQClientException {
String namespace = NamesrvUtil.NAMESPACE_PROJECT_CONFIG;
return this.mQClientFactory.getMQClientAPIImpl().getKVConfigByValue(namespace, projectGroup, 3000);
}
示例6: deleteIpsByProjectGroup
@Override
public void deleteIpsByProjectGroup(String projectGroup) throws RemotingException, MQBrokerException,
InterruptedException, MQClientException {
String namespace = NamesrvUtil.NAMESPACE_PROJECT_CONFIG;
this.mQClientFactory.getMQClientAPIImpl().deleteKVConfigByValue(namespace, projectGroup, 3000);
}