Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dubbo-3829] support google pb generic invocation #3975

Merged
merged 10 commits into from
May 8, 2019

Conversation

vio-lin
Copy link
Contributor

@vio-lin vio-lin commented May 5, 2019

What is the purpose of the change

Currently, Generic Reference cannot support Google Protobuf. With bride usage of Google PB, we are going to support it via Generic Reference. See issue #3829

Brief changelog

  1. add ProtobufUtils.class to serialize /deserialize Google Protobuf Object
  2. modify GenericFilter.class and ProtocolUtils.class

feedback wanted

To support Google PB Testing, GenericFilter is part of my change, also Service Metadata have to support that. If the solution is ok, i will continue on the Service Metadata part.

  • Make sure there is a GITHUB_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn clean install -DskipTests=false & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

@beiwei30
Copy link
Member

beiwei30 commented May 5, 2019

I revisit this change today. I am hesitate to introduce protobuf dependency in dubbo-rpc-api too. Is it possible to introduce protobuf serialization impl in 'dubbo-serialization' first, then use it in GenericFilter like this:

                if (ProtocolUtils.isJavaGenericSerialization(generic)) {
                    try {
                        UnsafeByteArrayOutputStream os = new UnsafeByteArrayOutputStream(512);
                        ExtensionLoader.getExtensionLoader(Serialization.class)
                                .getExtension(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA)
                                .serialize(null, os).writeObject(result.getValue());

or does 'dubbo-protostuff-serialization' meet your needs?

Copy link
Member

@beiwei30 beiwei30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls. check comments. I think we should find protobuf's serializer then use it, instead of introducing a direct dependency to protobuf.

@vio-lin vio-lin force-pushed the support-generic-reference-googlePb branch from 8eaf64e to 51fe044 Compare May 8, 2019 01:05
dubbo-all/pom.xml Outdated Show resolved Hide resolved
dubbo-bom/pom.xml Outdated Show resolved Hide resolved
dubbo-distribution/pom.xml Outdated Show resolved Hide resolved
@beiwei30
Copy link
Member

beiwei30 commented May 8, 2019

pls. also revert your change in dubbo-distrbution/pom.xml. It is unnecessary any longer.

@beiwei30
Copy link
Member

beiwei30 commented May 8, 2019

LGTM now.

@beiwei30
Copy link
Member

beiwei30 commented May 8, 2019

there's one CI failure:

[ERROR]   The project org.apache.dubbo:dubbo-serialization:2.7.2-SNAPSHOT (/home/travis/build/apache/incubator-dubbo/dubbo-serialization/pom.xml) has 1 error
[ERROR]     Child module /home/travis/build/apache/incubator-dubbo/dubbo-serialization/dubbo-serialization-protobuf-json of /home/travis/build/apache/incubator-dubbo/dubbo-serialization/pom.xml does not exist
[ERROR]

@chickenlj
Copy link
Contributor

This is a quite dependent module, I think we can merge it to the main branch and keep improving it. I will give it a test once I get some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants