美文网首页
dapeng-command-tool

dapeng-command-tool

作者: 偶像本人 | 来源:发表于2018-03-26 14:28 被阅读0次

开发

1、分支:command-tool
2、创建命令(查询元信息命令)implements Command

public class MetaInfoCmd implements Command {

    private static final String NAMESPACE = "syscmd";
    private static final String ACTION_NAME = "metaInfo";
    @Override
    public Descriptor getDescriptor() {
        return new Descriptor() {
            //...
            //命令描述
        };
    }
    @Override
    public Object execute(Context ctx) {
        //执行命令
    }
}

3、pom文件加上配置,jar包打到dapeng-command-tool模块的dist/plugins目录下。

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <outputDirectory>${project.basedir}/dist/plugins</outputDirectory>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>

4、修改dist目录下的配置文件cli.config,在controller的inputPattern加上对应命令metaInfo

"controllers":{
        "org.clamshellcli.impl.CmdController":{
            "enabled":"true",
            "inputPattern":"\\s*(exit|help|sysinfo|time|metaInfo)\\b.*",
            "expectedInputs":[]
        }
    }

5、resource的META-INF/service下org.clamshellcli.api.Plugin 加上对应的Commandcom.isuwang.dapeng.tools.commands.MetaInfoCmd
6、进入dist目录,执行 java -jar cli.jar

image.png

功能

1、能设置某个zk节点的值, 参数包括zk目录路径, 以及设置的值
2、通过指定服务名,或服务名+版本号,获取对应的服务的容器ip和端口
3、通过服务名和版本号,获取元信息
4、通过json文件,请求对应服务,并打印结果
5、通过xml文件,请求对应服务,并打印结果:
6、通过系统参数,json文件,调用指定服务器的服务并打印结果
7、通过系统参数,xml文件,调用指定服务器的服务并打印结果
8、通过服务名/版本号/方法名,获取请求json的示例
9、通过服务名/版本号/方法名,获取请求xml的示例
10、获取当前zookeeper中的服务路由信息
11、指定配置文件,设置路由信息
12、获取指定的zookeeper上所有运行的服务列表

相关文章

  • dapeng-command-tool

    开发 1、分支:command-tool2、创建命令(查询元信息命令)implements Command 3、p...

网友评论

      本文标题:dapeng-command-tool

      本文链接:https://www.haomeiwen.com/subject/fihrcftx.html