项目作者: guxingke

项目描述 :
a command line dubbo telnet wrapper
高级语言: Java
项目地址: git://github.com/guxingke/dubbo-cli.git
创建时间: 2019-04-30T11:04:46Z
项目社区:https://github.com/guxingke/dubbo-cli

开源协议:

下载


Dubbo-cli

简单 dubbo telnet 包装.
方便临时调用和调试.

特性

支持多 dubbo provider

应用场景多个 dubbo 应用

支持多环境

快速切换至 local, test, beta 等环境

查看接口信息

基于 dubbo telnet ls 命令

普通调用

基于 dubbo telnet invoke 命令

别名调用

基于普通调用, 支持配置模板, 可调用时动态传参

快速开始

安装

  1. brew tap guxingke/repo && brew install dubbo

示例

示例提供者代码provider

示例操作

  1. # in
  2. dubbo help
  3. # out
  4. Example usage:
  5. dubbo init // init base cfg
  6. dubbo deinit // reverse init , for re init or uninstall
  7. dubbo ls [Service] // show dubbo service or service detail
  8. dubbo status(st) // show active context, env.
  9. dubbo context(ctx) <subcmd> [args] // context operation
  10. dubbo env <subcmd> [args] // context operation
  11. dubbo invoke // call rpc or call alias rpc
  12. Troubleshooting:
  13. dubbo config // show cfg
  14. Further help:
  15. dubbo cmd help
  16. dubbo version
  17. # in
  18. dubbo init
  19. # out
  20. ~
  21. # in
  22. dubbo st
  23. # out
  24. Active Context: default
  25. Active Env: local
  26. Env Detail: Env(host=127.0.0.1, port=20880, link=telnet, charset=GBK)
  27. # in
  28. dubbo ls
  29. # out
  30. PROVIDER:
  31. com.gxk.demo.service.HelloService -> published: N
  32. # in
  33. dubbo ls com.gxk.demo.service.HelloService
  34. # out
  35. com.gxk.demo.service.HelloService (as provider):
  36. com.gxk.demo.service.TestResp hello1(com.gxk.demo.service.TestReq)
  37. java.lang.String hello(java.lang.String)
  38. # in
  39. dubbo invoke test 'com.gxk.demo.service.HelloService.hello("xx")'
  40. # out
  41. "Hello xx, response from provider: null"
  42. # in
  43. dubbo invoke test 'com.gxk.demo.service.HelloService.hello1({"id": "1","msg": "xx"})'
  44. # out
  45. {"id":"1","msg":"xx"}
  46. # in
  47. dubbo invoke set f1 'com.gxk.demo.service.HelloService.hello1({"id": "{}","msg": "xx"})' 10
  48. # out
  49. ~
  50. # in
  51. dubbo invoke f1
  52. # out
  53. {"id":"10","msg":"xx"}
  54. # in
  55. dubbo invoke f1 20
  56. # out
  57. {"id":"20","msg":"xx"}
  58. # 命令用法参考 dubbo <cmd> help,
  59. # e.g
  60. # in
  61. dubbo invoke help
  62. # out
  63. dubbo telnet invoke wrapper
  64. USAGE:
  65. - test call
  66. test <service>.<method>(<args>)
  67. - alias call
  68. ls # list all alias
  69. <alias> <arg1> <arg2> # e.g f1 "test" true
  70. set <alias> <tpl> <default args> # e.g set f1 test.HelloService.hello("{}", {}) test,true
  71. rm <alias> # e.g rm f1

支持版本

  • dubbox 2.8.4
  • dubbo 2.7.1

限制

某些 dubbo 版本不支持, 已知 2.7.0 不支持

仅支持 Unix*

概念

context

上下文, 对应多个 dubbo provider

env

环境, 同一个 context 下多个环境, 可对应不同的应用实例, e.g local, test, beta…

invoke alias

别名, 用来快速调用, 支持默认值, 和传参替换, 模板预发使用 slf4j 日志格式, e.g “xxx: {}”

开发

环境

  • maven 3.3+
  • jdk 1.8+
  • graalvm 1.0+

构建

  1. mvn clean package
  2. ./build.sh # build binary executable file named dubbo.

安装

  1. mv target/dubbo ~/.local/bin

或者

  1. ln -snf `pwd`/target/dubbo ~/.local/dubbo

变更记录

  • 基本可用