簡單 dubbo telnet 包裝. 方便臨時調用和調試.java
應用場景多個 dubbo 應用git
快速切換至 local, test, beta 等環境github
基於 dubbo telnet ls 命令bash
基於 dubbo telnet invoke 命令app
基於普通調用, 支持配置模板, 可調用時動態傳參maven
brew tap guxingke/repo && brew install dubbo
複製代碼
# in
dubbo help
# out
Example usage:
dubbo init // init base cfg
dubbo deinit // reverse init , for re init or uninstall
dubbo ls [Service] // show dubbo service or service detail
dubbo status(st) // show active context, env.
dubbo context(ctx) <subcmd> [args] // context operation
dubbo env <subcmd> [args] // context operation
dubbo invoke // call rpc or call alias rpc
Troubleshooting:
dubbo config // show cfg
Further help:
dubbo cmd help
dubbo version
# in
dubbo init
# out
~
# in
dubbo st
# out
Active Context: default
Active Env: local
Env Detail: Env(host=127.0.0.1, port=20880, link=telnet, charset=GBK)
# in
dubbo ls
# out
PROVIDER:
com.gxk.demo.service.HelloService -> published: N
# in
dubbo ls com.gxk.demo.service.HelloService
# out
com.gxk.demo.service.HelloService (as provider):
com.gxk.demo.service.TestResp hello1(com.gxk.demo.service.TestReq)
java.lang.String hello(java.lang.String)
# in
dubbo invoke test 'com.gxk.demo.service.HelloService.hello("xx")'
# out
"Hello xx, response from provider: null"
# in
dubbo invoke test 'com.gxk.demo.service.HelloService.hello1({"id": "1","msg": "xx"})'
# out
{"id":"1","msg":"xx"}
# in
dubbo invoke set f1 'com.gxk.demo.service.HelloService.hello1({"id": "{}","msg": "xx"})' 10
# out
~
# in
dubbo invoke f1
# out
{"id":"10","msg":"xx"}
# in
dubbo invoke f1 20
# out
{"id":"20","msg":"xx"}
# 命令用法參考 dubbo <cmd> help,
# e.g
# in
dubbo invoke help
# out
dubbo telnet invoke wrapper
USAGE:
- test call
test <service>.<method>(<args>)
- alias call
ls # list all alias
<alias> <arg1> <arg2> # e.g f1 "test" true
set <alias> <tpl> <default args> # e.g set f1 test.HelloService.hello("{}", {}) test,true
rm <alias> # e.g rm f1
複製代碼
上下文, 對應多個 dubbo provideride
環境, 同一個 context 下多個環境, 可對應不一樣的應用實例, e.g local, test, beta...ui
別名, 用來快速調用, 支持默認值, 和傳參替換, 模板預發使用 slf4j 日誌格式, e.g "xxx: {}"spa
mvn clean package
./build.sh # build binary executable file named dubbo.
複製代碼
mv target/dubbo ~/.local/bin
複製代碼
或者調試
ln -snf `pwd`/target/dubbo ~/.local/dubbo
複製代碼