Search in sources :

Example 1 with RestSender

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);
    }
}
Also used : SubCommandException(org.apache.rocketmq.tools.command.SubCommandException) RestSender(org.apache.rocketmq.connect.cli.utils.RestSender) URL(java.net.URL) SubCommandException(org.apache.rocketmq.tools.command.SubCommandException)

Example 2 with RestSender

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);
    }
}
Also used : SubCommandException(org.apache.rocketmq.tools.command.SubCommandException) RestSender(org.apache.rocketmq.connect.cli.utils.RestSender) URL(java.net.URL) SubCommandException(org.apache.rocketmq.tools.command.SubCommandException)

Example 3 with RestSender

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);
    }
}
Also used : SubCommandException(org.apache.rocketmq.tools.command.SubCommandException) RestSender(org.apache.rocketmq.connect.cli.utils.RestSender) URL(java.net.URL) SubCommandException(org.apache.rocketmq.tools.command.SubCommandException)

Example 4 with RestSender

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);
    }
}
Also used : SubCommandException(org.apache.rocketmq.tools.command.SubCommandException) RestSender(org.apache.rocketmq.connect.cli.utils.RestSender) URL(java.net.URL) SubCommandException(org.apache.rocketmq.tools.command.SubCommandException)

Example 5 with RestSender

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);
    }
}
Also used : SubCommandException(org.apache.rocketmq.tools.command.SubCommandException) RestSender(org.apache.rocketmq.connect.cli.utils.RestSender) URL(java.net.URL) SubCommandException(org.apache.rocketmq.tools.command.SubCommandException)

Aggregations

URL (java.net.URL)11 RestSender (org.apache.rocketmq.connect.cli.utils.RestSender)11 SubCommandException (org.apache.rocketmq.tools.command.SubCommandException)11 IOException (java.io.IOException)1