dubbo服务telnet命令
在命令行直接调用dubbo,方便模拟dubbo请求,进行断点测试
参数是json格式
如果类型是set或list
示例: invoke com.test.DemoService.query([1,2])
处理enum
invoke com.market.manageclient.module.discount.DiscountReadService.getDiscountItemByShop(5523,"Taobao")
其中"Taobao" 对应ThirdPartyPlatform.Taobao
telnet localhost 20880
连接到本地的dubbo telnet端口,然后执行invoke xx
示例: invoke com.test.DemoService.queryDemoPageList({"id":"100"}, 1, 2)
示例2: invoke com.shandiangou.market.open.api.DeliveryPromotionQueryService.query({"shopIds":[5523],"specialPriceIds":[10088]} )
error list
1. java.lang.ClassCastException: java.util.HashMap cannot be cast to
说明:如果参数中有List<T>,传入jsonArrStr会报错
解决方法: InvokeTelnetHandler 中第95行改下
原来: Object[] array = PojoUtils.realize(list.toArray(), invokeMethod.getParameterTypes());
改为:Object[] array = PojoUtils.realize(list.toArray(), invokeMethod.getParameterTypes(), invokeMethod.getGenericParameterTypes());
2.4.9和2.5.3 这两个版本,这个类文件代码完全相同
可以直接把修改后的文件放到项目中,这个是telnet dubbo才会用,所以可以直接发布
对于多module项目,放到web module中,避免子module被打成jar包,造成加载顺序的不确定