You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/07/29 17:50:29 UTC
[GitHub] [rocketmq-externals] Dreaouth opened a new pull request #607: [ISSUE #570]ASoC connect runtime optimization: CLI
Dreaouth opened a new pull request #607:
URL: https://github.com/apache/rocketmq-externals/pull/607
## What is the purpose of the change
XXXXX
## Brief changelog
XX
## Verifying this change
XXXX
Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
- [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
- [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
- [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test` to make sure integration-test pass.
- [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq-externals] Dreaouth commented on a change in pull request #607: [ISSUE #570]ASoC connect runtime optimization: CLI
Posted by GitBox <gi...@apache.org>.
Dreaouth commented on a change in pull request #607:
URL: https://github.com/apache/rocketmq-externals/pull/607#discussion_r464434619
##########
File path: rocketmq-connect/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/tools/command/StopAllSubCommand.java
##########
@@ -0,0 +1,35 @@
+package org.apache.rocketmq.connect.runtime.tools.command;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.rocketmq.connect.runtime.rest.RestSender;
+import org.apache.rocketmq.tools.command.SubCommandException;
+
+public class StopAllSubCommand implements SubCommand {
+ @Override
+ public String commandName() {
+ return "stopAll";
+ }
+
+ @Override
+ public String commandDesc() {
+ return "Stop and delete all Connectors and all configuration information";
+ }
+
+ @Override
+ public Options buildCommandlineOptions(Options options) {
+ return options;
+ }
+
+ @Override
+ public void execute(CommandLine commandLine, Options options) throws SubCommandException {
+ try {
+ String url = "http://localhost:8081/connectors/" + commandName();
Review comment:
I have avoid hardcoded by adding the configuration file
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq-externals] Dreaouth commented on a change in pull request #607: [ISSUE #570]ASoC connect runtime optimization: CLI
Posted by GitBox <gi...@apache.org>.
Dreaouth commented on a change in pull request #607:
URL: https://github.com/apache/rocketmq-externals/pull/607#discussion_r464478024
##########
File path: rocketmq-connect/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/tools/MQConnectAdminStartup.java
##########
@@ -0,0 +1,115 @@
+package org.apache.rocketmq.connect.runtime.tools;
+
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.rocketmq.common.MQVersion;
+import org.apache.rocketmq.connect.runtime.tools.command.*;
+import org.apache.rocketmq.connect.runtime.utils.ServerUtil;
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MQConnectAdminStartup {
+ protected static List<SubCommand> subCommandList = new ArrayList<SubCommand>();
+
+
+ public static void main(String[] args) {
Review comment:
Added README
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq-externals] imaffe commented on a change in pull request #607: [ISSUE #570]ASoC connect runtime optimization: CLI
Posted by GitBox <gi...@apache.org>.
imaffe commented on a change in pull request #607:
URL: https://github.com/apache/rocketmq-externals/pull/607#discussion_r464160137
##########
File path: rocketmq-connect/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/tools/command/StopAllSubCommand.java
##########
@@ -0,0 +1,35 @@
+package org.apache.rocketmq.connect.runtime.tools.command;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.rocketmq.connect.runtime.rest.RestSender;
+import org.apache.rocketmq.tools.command.SubCommandException;
+
+public class StopAllSubCommand implements SubCommand {
+ @Override
+ public String commandName() {
+ return "stopAll";
+ }
+
+ @Override
+ public String commandDesc() {
+ return "Stop and delete all Connectors and all configuration information";
+ }
+
+ @Override
+ public Options buildCommandlineOptions(Options options) {
+ return options;
+ }
+
+ @Override
+ public void execute(CommandLine commandLine, Options options) throws SubCommandException {
+ try {
+ String url = "http://localhost:8081/connectors/" + commandName();
Review comment:
Why this url is hardcoded in code ~
##########
File path: rocketmq-connect/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/rest/RestSender.java
##########
@@ -0,0 +1,38 @@
+package org.apache.rocketmq.connect.runtime.rest;
Review comment:
We need to add Apache header at the start of each file~
##########
File path: rocketmq-connect/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/tools/command/CreateConnectorSubCommand.java
##########
@@ -0,0 +1,62 @@
+package org.apache.rocketmq.connect.runtime.tools.command;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.rocketmq.connect.runtime.rest.RestSender;
+import org.apache.rocketmq.tools.command.SubCommandException;
+
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+
+public class CreateConnectorSubCommand implements SubCommand {
+ @Override
+ public String commandName() {
+ return "createConnector";
+ }
+
+ @Override
+ public String commandDesc() {
+ return "Create and start a connector by connector's config";
+ }
+
+ @Override
+ public Options buildCommandlineOptions(Options options) {
+ Option opt = new Option("c", "connectorName", true, "connector name");
+ opt.setRequired(true);
+ options.addOption(opt);
+ opt = new Option("p", "path", true, "Configuration file path");
+ opt.setRequired(true);
+ options.addOption(opt);
+ return options;
+ }
+
+ @Override
+ public void execute(CommandLine commandLine, Options options) throws SubCommandException {
+ try{
+ String connectorName = commandLine.getOptionValue('c').trim();
+ String baseUrl = "http://localhost:8081/connectors/" + connectorName + "?config=";
+ String filePath = commandLine.getOptionValue('p').trim();
+ String config = readFile(filePath);
+ System.out.println("Send request to " + baseUrl + config);
Review comment:
Is this format clear enough for users?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq-externals] imaffe commented on a change in pull request #607: [ISSUE #570]ASoC connect runtime optimization: CLI
Posted by GitBox <gi...@apache.org>.
imaffe commented on a change in pull request #607:
URL: https://github.com/apache/rocketmq-externals/pull/607#discussion_r464164304
##########
File path: rocketmq-connect/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/tools/MQConnectAdminStartup.java
##########
@@ -0,0 +1,115 @@
+package org.apache.rocketmq.connect.runtime.tools;
+
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.rocketmq.common.MQVersion;
+import org.apache.rocketmq.connect.runtime.tools.command.*;
+import org.apache.rocketmq.connect.runtime.utils.ServerUtil;
+import org.apache.rocketmq.remoting.protocol.RemotingCommand;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MQConnectAdminStartup {
+ protected static List<SubCommand> subCommandList = new ArrayList<SubCommand>();
+
+
+ public static void main(String[] args) {
Review comment:
how about lets add a readme for this CLI tool ~
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq-externals] Dreaouth closed pull request #607: [ISSUE #570]ASoC connect runtime optimization: CLI
Posted by GitBox <gi...@apache.org>.
Dreaouth closed pull request #607:
URL: https://github.com/apache/rocketmq-externals/pull/607
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq-externals] Dreaouth commented on a change in pull request #607: [ISSUE #570]ASoC connect runtime optimization: CLI
Posted by GitBox <gi...@apache.org>.
Dreaouth commented on a change in pull request #607:
URL: https://github.com/apache/rocketmq-externals/pull/607#discussion_r464433922
##########
File path: rocketmq-connect/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/rest/RestSender.java
##########
@@ -0,0 +1,38 @@
+package org.apache.rocketmq.connect.runtime.rest;
Review comment:
I have added Apache header at the start of each file
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org