dubbo
dubbo copied to clipboard
setOnreturn doesn't take effect in async generic invocation
原例子
Object xx = s.$invoke("Test", t, p);
发现bug在FutureFilter.fireInvokeCallback的
final Method onInvokeMethod = (Method)StaticContext.getSystemContext().get(StaticContext.getKey(invoker.getUrl(), invocation.getMethodName(), Constants.ON_INVOKE_METHOD_KEY));
就是这个invocation.getMethodName() 这个值是$invoke 而不是Test 而StaticContext.getSystemContext()的key是用Test方法明作为key
准确定位就是invocation.getMethodName() 在异步时,设置出错。设置成了$invoke
dubbo.rpc模块 hack修改过代码---------------- StaticContext.java
oldcode:line 62
public static String getKey(URL url, String methodName, String suffix) {
return getKey(url.getServiceKey(), methodName, suffix);
}
-------change to
public static String getKey(URL url, String methodName, String suffix) {
if("$invoke".equals(methodName)){
methodName = url.getParameter("methods");
}
return getKey(url.getServiceKey(), methodName, suffix);
}
这段代码比较丑陋写死$invoke,暂时可以解决问题。
@chickenlj 异步泛化调用适用于API网关对接内部Dubbo应用,这个问题有更好的解法吗
准确定位就是invocation.getMethodName() 在异步时,设置出错。设置成了$invoke
我们遇到过这个问题,内部版本修复掉了,但忘记回馈给社区了,抱歉。