apache / servicecomb-java-chassis

ServiceComb Java Chassis is a Software Development Kit (SDK) for rapid development of microservices in Java, providing service registration, service discovery, dynamic routing, and service management features
Apache License 2.0
1.91k stars 813 forks source link

servicecomb由 1.X升级至 2.X 后InvokerUtils.syncInvoke()无法适配场景咨询 #4259

Open asdxiab opened 8 months ago

asdxiab commented 8 months ago

业务网关implements InvocationHandler,在反射中做rpc调用,但是升级servicecomb后 InvokerUtils.syncInvoke方法参数变了,这个有啥办法处理Object[] args 转成 <String, Object> swaggerArguments,尝试过将method中parameters的name做key,但是没发保证arg[]顺序和method入参一致

例如: public class Invoker implements InvocationHandler { @Override
public Object invoke(Object proxy, Method method, Object[] args) { Object response = InvokerUtils.syncInvoke(microserviceName, microserviceSchemaId, microserviceOperationId,args); } }

liubao68 commented 8 months ago

2.x 使用弱类型契约。 需要和 swagger 的参数匹配,而不是服务端的java代码参数匹配。