Browsed by
标签:Dubbo

好烂啊有点差凑合看看还不错很精彩 (1 votes, average: 5.00 out of 5)
Loading...
531 views
Dubbo服务命令

Dubbo服务命令

命令列表

  • 进入shell终端连接服务命令:
telnet ip 端口号 ,按回车键进入dubbo命令模式。
  • 查看服务列表命令:
 ls 
ls
  • 查看服务详细列表:
ls -l
  • 查看某个服务的方法列表:
ls ***Service
  • 查看服务的方法的详细列表:
ls -l ***Service
  1. 调用服务的接口命令:
invoke com.test.TestService.selectBuyId('name')
  • 调用服务的方法:
invoke ***Service.***Method('name')
  • 查看状态列表:
status -l
  • 退出当前telnet命令行:
exit

代码演示

命令行调用dubbo远程服务

telnet远程连接到dubbo

[admin@dev666 ~]$ telnet 172.20.20.85 20888
Trying 172.20.20.85...
Connected to 172.20.20.85 (172.20.20.85).
Escape character is '^]'.

查看提供服务的接口

dubbo>ls com.vj.facade.DayDayRiskCheckFacade
No such service com.vj.facade.DayDayRiskCheckFacade
dubbo>ls
com.vj.facade.DayDayRiskCheckFacadeTransFacade
com.vj.facade.DayDayRiskCheckFacadePolicyQueryFacade
com.vj.facade.DayDayRiskCheckFacadeCheckFacade
com.vj.facade.DayDayRiskCheckFacadeFacade
dubbo>Connection closed by foreign host.
dubbo>ls
com.vj.service.TestInfoQueryService

ls 接口名对外提供的方法


dubbo>ls com.vj.service.TestInfoQueryService
queryByInfoCode
queryInfo

invoke调用服务

invoke 接口名.方法名(参数) 进行调用

dubbo>invoke com.vj.service.TestInfoQueryService.queryByInfoCode("00000A0")
{"result":{"infoCode":"info0","stat":"001","ip":"192.168.1.0","infoOwncode":"自编号0","phone":"13600000","infoAreaCode":"12345","address":"地址0","date":"2017-01-22 00:00:00","addressType":"0001","name":"名称0","id":14001,"contacts":"联系人0","infoCode":"00000A0"},"errorCode":"INFOCODE000000","errorMsg":"获取信息成功。"}
dubbo>invoke TestInfoQueryService.queryByInfoCode({"data":{"toCustomerId":"tcid-03-001","customerId":"cid-03-001","customerName":"cname1"},"checkPoint":"CP002"})

-end-

跳至工具栏