This sample code demonstrates building up dubbo service provider and service consumer with the pure API approach.
Google protocol file is in protobuf-json-serialization-api\src\main\resources\protobuf\googleProtobufBasic.proto. when protocol be modified, should refresh org.apache.dubbo.sample.protobuf.GoogleProtobufBasic.
- modify googleProtobufBasic.proto
- add protobuf-maven-plugin to dubbo-samples-protobuf\protobuf-json-serialization-api\pom.xml
- run bash
mvn generate-sources
- copy code generated located in target directory to dubbo-samples-protobuf\protobuf-json-serialization-api\src\main\java
Main class: org.apache.dubbo.sample.protobuf.provider.ProviderStarter
normar client
Main class: org.apache.dubbo.sample.protobuf.consumer.ConsumerStarter
generic reference
Main class: org.apache.dubbo.sample.protobuf.genericCall.GenericClient
When invoke service with generic reference, we can construct request by referencing service meta data. Demo show how to use service meta data.
org.apache.dubbo.sample.protobuf.genericCall.GenericClient.printServiceData