Git Product home page Git Product logo

Comments (5)

pantianying avatar pantianying commented on June 16, 2024

客户端的生成源码在com.alibaba.dubbo.config.ReferenceConfig

调用ReferenceConfig.get()获取服务端泛化接口,源码有点多就不贴了

from dubbo-go-hessian2.

pantianying avatar pantianying commented on June 16, 2024

贴一下使用的java代码吧

    public static Object invokeDubbo(UrlPathInfo pathInfo, Object[] parameterObjects) {
        ReferenceConfig<GenericService> referenceConfig = null;
        try {
            referenceConfig = referenceConfigLoadingCache.get(pathInfo);
        } catch (ExecutionException e) {
            logger.error("get referenceConfig from jvm cache has error", e);
        }
        if (referenceConfig == null) {
            referenceConfig = buildReferenceConfig(pathInfo);
            if (referenceConfig != null) {
                referenceConfigLoadingCache.refresh(pathInfo);
            }
        }

        GenericService genericService = referenceConfig.get();
        String[] paramTypes = pathInfo.getParameterTypes();
        Object returnValue = genericService.$invoke(pathInfo.getMethodName(), paramTypes, parameterObjects);
        //void 返回为null
        return returnValue;
    }

from dubbo-go-hessian2.

wongoo avatar wongoo commented on June 16, 2024

@pantianying 沟通,目前golang hessian2不支持反序列化未定义的pojo数据为map,而java是可以的,需要调研的是java的实现机制是如何? 是不是针对泛化的请求,java server端会用map的方式来序列化返回数据? 如果对java有研究的,请分享一下!

from dubbo-go-hessian2.

pantianying avatar pantianying commented on June 16, 2024

@wongoo
是的 go客户端要实现pojo到map,这部分应该是要放在hessain2里

这个观点是错误的

from dubbo-go-hessian2.

pantianying avatar pantianying commented on June 16, 2024

@wongoo @fangyincheng

大家好,根据阅读源码和@fangyincheng一起测试,pojo到map的步骤确认是在java的provder实现了,目前goclient端利用如下的interface定义,可以调通java provider端的泛化调用。
image

image

因为java服务端只把pojo转成了map,客户端目前还需要区别pojo数组还是单个pojo。这个希望能通过一个interface{} 接受所有的返回。

这个实现需要两位评估。

from dubbo-go-hessian2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.