Dubbo服务命令

Dubbo服务命令

閱讀本文約花費: 2 (分鐘)

命令列表

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

代码演示

命令行调用dubbo远程服务

telnet远程连接到dubbo [shell] [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 ‘^]’. [/shell]

查看提供服务的接口

[java] 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 [/java]

ls 接口名对外提供的方法

[shell] dubbo>ls com.vj.service.TestInfoQueryService queryByInfoCode queryInfo [/shell]

invoke调用服务

invoke 接口名.方法名(参数) 进行调用 [shell] 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"}) [/shell] -end-
Rate this post

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注