最近在弄 rocketmq replicator相关的开源工作, 这里记录下 connect 的调试步骤:

  1. 启动 connect-runtime 直接 参照 rocketmq-connect README.md, 足够用了

  2. 启动 connect-sample

  • 执行 mvn clean install -Dmaven.test.skip=true 打包
  • 将target目录下的jar复制到 runtime 配置的 pluginPath 下面
  • 执行下面的 curl 命令启动 sample connect curl http://localhost:8081/connectors/test0\?config\=%7b%22connector-class%22%3a%22org.apache.rocketmq.connect.file.FileSourceConnector%22%2c%22topic%22%3a%22fileTopic%22%2c%22filename%22%3a%22%2fhome%2fconnect%2frocketmq-externals%2frocketmq-connect%2frocketmq-connect-runtime%2fsource-file.txt%22%2c%22source-record-converter%22%3a%22org.apache.rocketmq.connect.runtime.converter.JsonConverter%22%7d 因为 rest http 编码的缘故, 这里进行了 urlencode 编码. 没有进行 urlencode 编码之前, 张这样 curl http://localhost:8081/connectors/test0\?config={"connector-class":"org.apache.rocketmq.connect.file.FileSourceConnector","topic":"fileTopic","filename":"home/connect/rocketmq-externals/rocketmq-connect/rocketmq-connect-runtime/source-file.txt","source-record-converter":"org.apache.rocketmq.connect.runtime.converter.JsonConverter"}