use of org.apache.rocketmq.connect.cli.utils.RestSender in project rocketmq-externals by apache.
the class ReloadPluginsSubCommand method execute.
@Override
public void execute(CommandLine commandLine, Options options) throws SubCommandException {
try {
String request = "/plugin/reload";
URL url = new URL(CLIConfigDefine.PROTOCOL, config.getHttpAddr(), config.getHttpPort(), request);
String result = new RestSender().sendHttpRequest(url.toString(), "");
System.out.printf("%s%n", result);
} catch (Exception e) {
throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
}
}
use of org.apache.rocketmq.connect.cli.utils.RestSender in project rocketmq-externals by apache.
the class GetConfigInfoSubCommand method execute.
@Override
public void execute(CommandLine commandLine, Options options) throws SubCommandException {
try {
String request = "/" + commandName();
URL url = new URL(CLIConfigDefine.PROTOCOL, config.getHttpAddr(), config.getHttpPort(), request);
String result = new RestSender().sendHttpRequest(url.toString(), "");
System.out.printf("%s%n", result);
} catch (Exception e) {
throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
}
}
use of org.apache.rocketmq.connect.cli.utils.RestSender in project rocketmq-externals by apache.
the class QueryConnectorStatusSubCommand method execute.
@Override
public void execute(CommandLine commandLine, Options options) throws SubCommandException {
try {
String connectorName = commandLine.getOptionValue('c').trim();
String request = "/connectors/" + connectorName + "/config";
URL url = new URL(CLIConfigDefine.PROTOCOL, config.getHttpAddr(), config.getHttpPort(), request);
String result = new RestSender().sendHttpRequest(url.toString(), "");
System.out.printf("%s%n", result);
} catch (Exception e) {
throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
}
}
use of org.apache.rocketmq.connect.cli.utils.RestSender in project rocketmq-externals by apache.
the class StopAllSubCommand method execute.
@Override
public void execute(CommandLine commandLine, Options options) throws SubCommandException {
try {
String request = "/connectors/" + commandName();
URL url = new URL(CLIConfigDefine.PROTOCOL, config.getHttpAddr(), config.getHttpPort(), request);
String result = new RestSender().sendHttpRequest(url.toString(), "");
System.out.printf("%s%n", result);
} catch (Exception e) {
throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
}
}
use of org.apache.rocketmq.connect.cli.utils.RestSender in project rocketmq-externals by apache.
the class GetAllocatedInfoCommand method execute.
@Override
public void execute(CommandLine commandLine, Options options) throws SubCommandException {
try {
String request = "/" + commandName();
URL url = new URL(CLIConfigDefine.PROTOCOL, config.getHttpAddr(), config.getHttpPort(), request);
String result = new RestSender().sendHttpRequest(url.toString(), "");
System.out.printf("%s%n", result);
} catch (Exception e) {
throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e);
}
}
Aggregations