Dubbo invoke 分号失误
1.环境:
dubbo 版本: 2.7.3
2.在项目配置文件找到dubbo配置相关的内容
dubbo.protocols.dubbo.name=dubbo dubbo.protocols.dubbo.port=27079 dubbo.registry.check=true
3.用telnet的方式连上dubbo,注意此时就是连上的状态,敲击任意命令才会出现“dubbo>”,提示符
sh-4.2# telnet 127.0.0.1 27079 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'.
4.执行invoke调用命令(此时需要特别注意,对于习惯了其他提示符,习惯在命令行加分号的同学,invoke的最后不能加分号)
sh-4.2# telnet 127.0.0.1 27079 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. ls PROVIDER: rctc.intserv.facade.api.intserv.api.IIntservModifyApiService:1.0.0 rctc.intserv.facade.api.intserv.api.IIntservSearchApiService:1.0.0 rctc.intserv.facade.intserv.phasecfg.api.IIntservPhaseCfgApiService:1.0.0 rctc.intserv.facade.api.intserv.api.IIntservApplySearchApiService:1.0.0 rctc.intserv.facade.api.intserv.api.IIntservRemoveApiService:1.0.0 rctc.intserv.facade.api.intserv.mgtapi.IRctcOldDataMigreateApiService:1.0.0 rctc.intserv.facade.api.intserv.api.IIntservAddApiService:1.0.0 rctc.intserv.facade.api.intserv.mgtapi.IIntservAddMgtApiService:1.0.0 rctc.intserv.facade.api.intserv.mgtapi.IIntservSearchMgtApiService:1.0.0 rctc.intserv.facade.api.intserv.mgtapi.IIntservRemoveMgtApiService:1.0.0 rctc.intserv.service.kafka.producer.service.IKafkaProducerService rctc.intserv.facade.api.intserv.mgtapi.IRctcOldDataMigreateCommonApiService:1.0.0 rctc.intserv.facade.api.intserv.mgtapi.IIntservModifyMgtApiService:1.0.0 CONSUMER: rctc.rmyhcorp.api.rmyh.mgtapi.IRmyhSearchMgtApiService:1.0.0rc.dccenter.facade.dccenter.dccenter.api.IRcDccenterQueryApiService:1.0.0fl.riskctrl.facade.riskctrl.api.IRiskCtrlSearchApiService:1.0.0rc.baffle.facade.baffle.api.api.IRcBaffleDataApiService:1.0.0 dubbo>invoke rctc.intserv.facade.api.intserv.mgtapi.IRctcOldDataMigreateCommonApiService.migrateOldApplyDataMigrate("1017","10170001","RC_ZWIS_APPLY","2022-11-03 00:00:00","APPLY_STATUS",[{"columnComments":"查询开始日期","keyColumn":"START_TM","keyName":"zwStartDate"},{"columnComments":"查询结束日期","keyColumn":"END_TM","keyName":"zwEndDate"}]) Use default service rctc.intserv.facade.api.intserv.mgtapi.IRctcOldDataMigreateCommonApiService. result: null elapsed: 30027 ms. dubbo>Connection closed by foreign host.
5.同样的语句加上分号,报错信息会让人怀疑人生
dubbo>invoke rctc.intserv.facade.api.intserv.mgtapi.IRctcOldDataMigreateCommonApiService.migrateOldApplyDataMigrate("1017","10170001","RC_ZWIS_APPLY","2022-11-03 00:00:00","APPLY_STATUS",[{"keyName":"zwStartDate","keyColumn":"START_TM","columnComments":"查询开始日期"},{"keyName":"zwEndDate","keyColumn":"END_TM","columnComments":"查询结束日期"}]); Invalid parameters, format: service.method(args) dubbo>
6.接口以及POJO的部分定义。dubbo的invoke可以很方便的将JSONObject,JSONARRAY与对应的参数匹配。
//POJO @Data public class RctcIntservApplyExtColumnDTO implements Serializable { private static final long serialVersionUID = 7571827010035691125L; /** * 对应三方特殊参数key 值 */ private String keyName; /** * 三方特殊参数key 值 对应的 apply 表附加字段 */ private String keyColumn; /** * apply 表附加字段注释 */ private String columnComments; } //interface public interface IRctcOldDataMigreateCommonApiService { /** * @param compCd * @param interfaceCd * @param tableName * @param endDate */ void migrateOldApplyDataMigrate(String compCd, String interfaceCd, String tableName, Date endDate, String applyStatusColumnName, List<RctcIntservApplyExtColumnDTO> extFld); }
参考文档:
1.https://dubbo.apache.org/zh/docs/v2.7/user/references/telnet/#invoke