Open sym695989697 opened 4 years ago
package com.hello.consumer;
import com.alibaba.dubbo.config.ApplicationConfig; import com.alibaba.dubbo.config.ReferenceConfig; import com.alibaba.dubbo.config.RegistryConfig; import com.alibaba.dubbo.rpc.service.GenericService;
/**
@since 2019/4/26 */ public class DubboGenericInvoker {
public static void main(String[] args) { ApplicationConfig application = new ApplicationConfig(); application.setName("api-generic-consumer");
RegistryConfig registry = new RegistryConfig(); registry.setAddress("zookeeper://172.20.30.76:2181"); application.setRegistry(registry); ReferenceConfig<GenericService> reference = new ReferenceConfig<GenericService>(); // 弱类型接口名 reference.setInterface("calc"); reference.setVersion("1.0.0"); reference.setGroup("dubbo"); // 声明为泛化接口 reference.setGeneric(true); reference.setApplication(application); // 用com.alibaba.dubbo.rpc.service.GenericService可以替代所有接口引用 GenericService genericService = reference.get(); Object name = genericService.$invoke("multi2", new String[] {String.class.getName()}, new Object[]{"2"}); System.out.println(name);
直接进 if not handler: logging.warning(f'no handler for {msg.service_name}.{msg.method_name}') continue 针对这个如何修改???在线等
@sym695989697 拖得有点久,泛型这块之前没有作处理,我在decode这边加了一些代码,目前简单类型能够跑通,见 3b925ff
package com.hello.consumer;
import com.alibaba.dubbo.config.ApplicationConfig; import com.alibaba.dubbo.config.ReferenceConfig; import com.alibaba.dubbo.config.RegistryConfig; import com.alibaba.dubbo.rpc.service.GenericService;
/**
@since 2019/4/26 */ public class DubboGenericInvoker {
public static void main(String[] args) { ApplicationConfig application = new ApplicationConfig(); application.setName("api-generic-consumer");
} }
直接进 if not handler: logging.warning(f'no handler for {msg.service_name}.{msg.method_name}') continue 针对这个如何修改???在线等