Skip to content

java 范型调用问题 #7

Description

@sym695989697

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;

/**

  • dubbo泛化调用invoker 调用入口

  • @author mazhenjie

  • @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
针对这个如何修改???在线等

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions