You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by zh...@apache.org on 2021/09/04 15:57:55 UTC
[dubbo-go-samples] 01/14: fix: init new config
This is an automated email from the ASF dual-hosted git repository.
zhaoyunxing pushed a commit to branch config-enhance
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
commit 07bf5eed368feba38edb81045fbd856172e56f30
Author: LaurenceLiZhixin <38...@qq.com>
AuthorDate: Sun Aug 1 15:51:01 2021 +0800
fix: init new config
---
.run/helloworld-go-server.run.xml | 4 +-
.run/{triple => }/triple-server.run.xml | 6 +-
go.sum | 11 +-
helloworld/README.md | 157 +--
helloworld/README_zh.md | 156 +--
helloworld/go-client/cmd/client.go | 38 +-
.../go-client}/cmd/env.sh | 0
helloworld/go-client/conf/client.yml | 72 +-
helloworld/go-client/conf/log.yml | 27 -
helloworld/go-server/cmd/server.go | 51 +-
helloworld/go-server/conf/client.yml | 59 -
helloworld/go-server/conf/log.yml | 27 -
helloworld/go-server/conf/server.yml | 72 +-
helloworld/go-server/docker/docker-health-check.sh | 10 -
helloworld/go-server/pkg/greeter.go | 45 +
helloworld/go-server/pkg/user.go | 52 -
.../go-server/tests/integration/main_test.go | 29 +-
.../tests/integration/userprovider_test.go | 26 +-
helloworld/java-client/build.sh | 21 -
.../org/apache/dubbo/sample/hello/Helloworld.java | 1432 ++++++++++++++++++++
helloworld/java-client/pom.xml | 294 ++--
helloworld/java-client/run.sh | 2 +
.../java-client/src/main/assembly/assembly.xml | 43 -
.../com/apache/dubbo/sample/basic/ApiConsumer.java | 52 +
.../com/apache/dubbo/sample/basic/IGreeter.java | 31 +
.../src/main/java/org/apache/dubbo/Consumer.java | 60 -
.../src/main/java/org/apache/dubbo/User.java | 76 --
.../main/java/org/apache/dubbo/UserProvider.java | 18 -
.../java-client/src/main/proto/helloworld.proto | 28 +
.../resources/META-INF/spring/dubbo.consumer.xml | 38 -
.../src/main/resources/META-INF/spring/service.xml | 24 -
.../src/main/resources/dubbo.properties | 12 -
.../src/main/resources/log4j.properties | 42 +-
helloworld/java-server/build.sh | 20 -
.../org/apache/dubbo/sample/hello/Helloworld.java | 1432 ++++++++++++++++++++
helloworld/java-server/pom.xml | 244 ++--
helloworld/java-server/run.sh | 2 +
helloworld/java-server/script/debug.sh | 23 -
.../java-server/src/main/assembly/assembly.xml | 44 -
.../com/apache/dubbo/sample/basic/ApiProvider.java | 39 +
.../com/apache/dubbo/sample/basic/IGreeter.java | 30 +
.../apache/dubbo/sample/basic/IGreeter1Impl.java | 34 +
.../src/main/java/org/apache/dubbo/Provider.java | 33 -
.../src/main/java/org/apache/dubbo/User.java | 86 --
.../main/java/org/apache/dubbo/UserProvider.java | 24 -
.../java/org/apache/dubbo/UserProviderImpl.java | 30 -
.../java-server/src/main/proto/helloworld.proto | 28 +
.../resources/META-INF/spring/dubbo.provider.xml | 34 -
.../src/main/resources/dubbo.properties | 13 -
.../src/main/resources/log4j.properties | 41 +-
helloworld/protobuf/helloworld.pb.go | 323 +++++
.../pkg/user.go => protobuf/helloworld.proto} | 35 +-
helloworld/protobuf/protobuf.mk | 26 +
logger/go-client/cmd/client.go | 2 +-
54 files changed, 3919 insertions(+), 1639 deletions(-)
diff --git a/.run/helloworld-go-server.run.xml b/.run/helloworld-go-server.run.xml
index ddf29c3..f098a7f 100644
--- a/.run/helloworld-go-server.run.xml
+++ b/.run/helloworld-go-server.run.xml
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
- <configuration default="false" name="helloworld-go-server" type="GoApplicationRunConfiguration" factoryName="Go Application" singleton="false">
+ <configuration default="false" name="helloworld-go-server" type="GoApplicationRunConfiguration" factoryName="Go Application" singleton="true">
<module name="dubbo-go-samples" />
<working_directory value="$PROJECT_DIR$" />
<envs>
@@ -7,9 +7,9 @@
<env name="CONF_PROVIDER_FILE_PATH" value="$PROJECT_DIR$/helloworld/go-server/conf/server.yml" />
</envs>
<kind value="PACKAGE" />
- <filePath value="$PROJECT_DIR$/helloworld/go-server/cmd/server.go" />
<package value="github.com/apache/dubbo-go-samples/helloworld/go-server/cmd" />
<directory value="$PROJECT_DIR$" />
+ <filePath value="$PROJECT_DIR$/helloworld/go-server/cmd/server.go" />
<method v="2" />
</configuration>
</component>
\ No newline at end of file
diff --git a/.run/triple/triple-server.run.xml b/.run/triple-server.run.xml
similarity index 68%
rename from .run/triple/triple-server.run.xml
rename to .run/triple-server.run.xml
index f36e0c3..b249d57 100644
--- a/.run/triple/triple-server.run.xml
+++ b/.run/triple-server.run.xml
@@ -2,14 +2,10 @@
<configuration default="false" name="triple-server" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="triple">
<module name="dubbo-go-samples" />
<working_directory value="$PROJECT_DIR$" />
- <envs>
- <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/general/dubbo3/pb/dubbogo-grpc/server/conf/log.yml" />
- <env name="CONF_PROVIDER_FILE_PATH" value="$PROJECT_DIR$/general/dubbo3/pb/dubbogo-grpc/server/dubbogo-server/conf/server.yml" />
- </envs>
<kind value="PACKAGE" />
- <filePath value="$PROJECT_DIR$/general/dubbo3/pb/dubbogo-grpc/server/dubbogo-server/cmd/server.go" />
<package value="github.com/apache/dubbo-go-samples/general/dubbo3/pb/dubbogo-grpc/server/dubbogo-server/cmd" />
<directory value="$PROJECT_DIR$" />
+ <filePath value="$PROJECT_DIR$/general/dubbo3/pb/dubbogo-grpc/server/dubbogo-server/cmd/server.go" />
<method v="2" />
</configuration>
</component>
\ No newline at end of file
diff --git a/go.sum b/go.sum
index 849c5de..ad2291c 100644
--- a/go.sum
+++ b/go.sum
@@ -12,11 +12,8 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
-dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20210708063655-af290429dee4 h1:JRGjw66CguqaOeYigLauTdccWqnvy7U3OYqAHzXYmlw=
-dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20210708063655-af290429dee4/go.mod h1:2l+IXuSuJvEk2g/ze1la8t1sX+yJH220aHo6JJVriM8=
dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20210725154253-9aeb7ff3c612 h1:uQMGg4Hnu/iO+RLrKIRsBXgJLUpLh+UG5NuVNGxGlsg=
dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2.0.20210725154253-9aeb7ff3c612/go.mod h1:RvuYcSX5rxb1aQTSol4EFt2txaJhzMmUAkT75lT9ETE=
-github.com/Azure/azure-sdk-for-go v40.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
@@ -115,6 +112,7 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd/v22 v22.1.0 h1:kq/SbG2BCKLkDKkjQf5OWwKWUKj1lgs3lFI4PxnR5lg=
github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
@@ -146,8 +144,7 @@ github.com/dubbogo/go-zookeeper v1.0.3 h1:UkuY+rBsxdT7Bs63QAzp9z7XqQ53W1j8E5rwl8
github.com/dubbogo/go-zookeeper v1.0.3/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
github.com/dubbogo/gost v1.10.1/go.mod h1:+mQGS51XQEUWZP2JeGZTxJwipjRKtJO7Tr+FOg+72rI=
-github.com/dubbogo/gost v1.11.13 h1:sWvK1QbHpPBMmRQJV9qIH3syLegQBQa4xAPof3/Kv5c=
-github.com/dubbogo/gost v1.11.13/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI=
+github.com/dubbogo/gost v1.11.14 h1:9lfcdILOmqTOVAW1fPHa5uf1NrD6jlIOBe4vf8576yQ=
github.com/dubbogo/gost v1.11.14/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI=
github.com/dubbogo/jsonparser v1.0.1/go.mod h1:tYAtpctvSP/tWw4MeelsowSPgXQRVHHWbqL6ynps8jU=
github.com/dubbogo/net v0.0.3 h1:2k53mh+1U8h1gFjJ8ykzyP4wNdAdgjc5moD+xVHI/AE=
@@ -319,9 +316,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92Bcuy
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+github.com/grpc-ecosystem/grpc-gateway v1.14.6 h1:8ERzHx8aj1Sc47mu9n/AksaKCSWrMchFtkdrS4BIj5o=
github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw=
-github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
-github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU=
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
@@ -964,7 +960,6 @@ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
-google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
diff --git a/helloworld/README.md b/helloworld/README.md
index c64d03a..893a170 100644
--- a/helloworld/README.md
+++ b/helloworld/README.md
@@ -1,135 +1,22 @@
-## Hello World Example
-
-### Configuration
-
-registy config
-
-```yaml
-# registry config
-registries:
- "demoZk":
- protocol: "zookeeper"
- timeout: "3s"
- address: "127.0.0.1:2181"
-
-```
-
-provider config
-
-```yaml
-# service config
-services:
- # Reference ID
- "UserProvider":
- registry: "demoZk"
- protocol: "dubbo"
- interface: "org.apache.dubbo.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
-```
-
-consumer config
-
-```yaml
-# reference config
-references:
- # Reference ID
- "UserProvider":
- registry: "demoZk"
- protocol: "dubbo"
- interface: "org.apache.dubbo.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
-```
-
-### Code
-
-provider
-
-```go
-// init
-func init() {
- config.SetProviderService(new(UserProvider))
- // ------for hessian2------
- hessian.RegisterPOJO(&User{})
-}
-
-// define dto
-type User struct {
- ID string
- Name string
- Age int32
- Time time.Time
-}
-
-// implement POJO interface for hessian2
-func (u User) JavaClassName() string {
- return "org.apache.dubbo.User"
-}
-
-// service define
-type UserProvider struct {
-}
-
-// interface define
-func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
- //biz code...
-}
-
-// implement RPCService interface
-func (u *UserProvider) Reference() string {
- return "UserProvider"
-}
-```
-
-consumer
-
-```go
-var userProvider = new(pkg.UserProvider)
-
-// init
-func init() {
- config.SetConsumerService(userProvider)
- hessian.RegisterPOJO(&pkg.User{})
-}
-
-// define dto
-type User struct {
- ID string
- Name string
- Age int32
- Time time.Time
-}
-
-// implement POJO interface for hessian2
-func (u User) JavaClassName() string {
- return "org.apache.dubbo.User"
-}
-
-// service define
-type UserProvider struct {
- GetUser func(ctx context.Context, req []interface{}, rsp *User) error
-}
-
-// implement RPCService interface
-func (u *UserProvider) Reference() string {
- return "UserProvider"
-}
-
-func main() {
- //dubbogo init
- config.Load()
- time.Sleep(3 * time.Second)
-
- user := &pkg.User{}
- err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
- if err != nil {
- //...
- }
- gxlog.CInfo("response result: %v\n", user)
-}
-```
\ No newline at end of file
+# Helloworld for Dubbo-go 3.0
+
+For pb definition and go client and server startup, please refer to [dubbogo-grpc](../dubbogo-grpc/README.md)
+
+## Instructions
+
+1. Start the server
+
+Use goland to start triple/gojava-go-server
+
+or
+
+Execute `sh run.sh` in the java-server folder to start the java server
+
+2. Start the client
+
+Use goland to start triple/gojava-go-client
+
+or
+
+Execute `sh run.sh` under the java-client folder to start the java client
+
diff --git a/helloworld/README_zh.md b/helloworld/README_zh.md
index 987f30e..d280c2e 100644
--- a/helloworld/README_zh.md
+++ b/helloworld/README_zh.md
@@ -1,135 +1,21 @@
-## Hello World 实例
-
-### 配置
-
-注册中心配置
-
-```yaml
-# registry config
-registries:
- "demoZk":
- protocol: "zookeeper"
- timeout: "3s"
- address: "127.0.0.1:2181"
-
-```
-
-服务提供者配置
-
-```yaml
-# service config
-services:
- # Reference ID
- "UserProvider":
- registry: "demoZk"
- protocol: "dubbo"
- interface: "org.apache.dubbo.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
-```
-
-服务消费者配置
-
-```yaml
-# reference config
-references:
- # Reference ID
- "UserProvider":
- registry: "demoZk"
- protocol: "dubbo"
- interface: "org.apache.dubbo.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
-```
-
-### 代码示例
-
-生产者示例
-
-```go
-// init
-func init() {
- config.SetProviderService(new(UserProvider))
- // ------for hessian2------
- hessian.RegisterPOJO(&User{})
-}
-
-// define dto
-type User struct {
- ID string
- Name string
- Age int32
- Time time.Time
-}
-
-// implement POJO interface for hessian2
-func (u User) JavaClassName() string {
- return "org.apache.dubbo.User"
-}
-
-// service define
-type UserProvider struct {
-}
-
-// interface define
-func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
- //biz code...
-}
-
-// implement RPCService interface
-func (u *UserProvider) Reference() string {
- return "UserProvider"
-}
-```
-
-消费者示例
-
-```go
-var userProvider = new(pkg.UserProvider)
-
-// init
-func init() {
- config.SetConsumerService(userProvider)
- hessian.RegisterPOJO(&pkg.User{})
-}
-
-// define dto
-type User struct {
- ID string
- Name string
- Age int32
- Time time.Time
-}
-
-// implement POJO interface for hessian2
-func (u User) JavaClassName() string {
- return "org.apache.dubbo.User"
-}
-
-// service define
-type UserProvider struct {
- GetUser func(ctx context.Context, req []interface{}, rsp *User) error
-}
-
-// implement RPCService interface
-func (u *UserProvider) Reference() string {
- return "UserProvider"
-}
-
-func main() {
- //dubbogo init
- config.Load()
- time.Sleep(3 * time.Second)
-
- user := &pkg.User{}
- err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
- if err != nil {
- //...
- }
- gxlog.CInfo("response result: %v\n", user)
-}
-```
\ No newline at end of file
+# Helloworld for Dubbo-go 3.0
+
+pb 定义以及 go 客户端、服务端启动,可以参考 [dubbogo-grpc](../dubbogo-grpc/README_zh.md)
+
+## 使用方法
+
+1. 启动服务端
+
+使用 goland 启动 triple/gojava-go-server
+
+或者
+
+在 java-server 文件夹下执行 `sh run.sh` 启动 java server
+
+2. 启动客户端
+
+使用 goland 启动 triple/gojava-go-client
+
+或者
+
+在 java-client 文件夹下执行 `sh run.sh` 启动 java client
diff --git a/helloworld/go-client/cmd/client.go b/helloworld/go-client/cmd/client.go
index c7e8235..3f40b44 100644
--- a/helloworld/go-client/cmd/client.go
+++ b/helloworld/go-client/cmd/client.go
@@ -19,7 +19,7 @@ package main
import (
"context"
- "os"
+ "fmt"
"time"
)
@@ -29,38 +29,40 @@ import (
_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
- _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
+ _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
_ "dubbo.apache.org/dubbo-go/v3/registry/protocol"
_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
-
- hessian "github.com/apache/dubbo-go-hessian2"
-
- gxlog "github.com/dubbogo/gost/log"
)
import (
- "github.com/apache/dubbo-go-samples/helloworld/go-client/pkg"
+ pb "github.com/apache/dubbo-go-samples/helloworld/protobuf"
)
-var userProvider = new(pkg.UserProvider)
+var grpcGreeterImpl = new(pb.GreeterClientImpl)
func init() {
- config.SetConsumerService(userProvider)
- hessian.RegisterPOJO(&pkg.User{})
+ config.SetConsumerService(grpcGreeterImpl)
}
-// need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run
+// deprecated: need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run
+// or config.Load(config.Path("..."))
func main() {
config.Load()
time.Sleep(3 * time.Second)
- gxlog.CInfo("\n\n\nstart to test dubbo")
- user := &pkg.User{}
- err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
+ fmt.Println("\n\n\nstart to test dubbo")
+ req := &pb.HelloRequest{
+ Name: "laurence",
+ }
+
+ reply := &pb.User{}
+
+ ctx := context.Background()
+ ctx = context.WithValue(ctx, "tri-req-id", "test_value_XXXXXXXX")
+
+ err := grpcGreeterImpl.SayHello(ctx, req, reply)
if err != nil {
- gxlog.CError("error: %v\n", err)
- os.Exit(1)
- return
+ panic(err)
}
- gxlog.CInfo("response result: %v\n", user)
+ fmt.Printf("client response result: %v\n", reply)
}
diff --git a/general/dubbo3/pb/dubbogo-grpc/unary-client/dubbogo-client/cmd/env.sh b/helloworld/go-client/cmd/env.sh
similarity index 100%
rename from general/dubbo3/pb/dubbogo-grpc/unary-client/dubbogo-client/cmd/env.sh
rename to helloworld/go-client/cmd/env.sh
diff --git a/helloworld/go-client/conf/client.yml b/helloworld/go-client/conf/client.yml
index 308d530..64b8ae1 100644
--- a/helloworld/go-client/conf/client.yml
+++ b/helloworld/go-client/conf/client.yml
@@ -1,59 +1,13 @@
-# dubbo client yaml configure file
-
-check: true
-# client
-request_timeout: "3s"
-# connect timeout
-connect_timeout: "3s"
-
-# application config
-application:
- organization: "dubbo.io"
- name: "UserInfoClient"
- module: "dubbo-go user-info client"
- version: "0.0.1"
- environment: "dev"
-
-# registry config
-registries:
- "demoZk":
- protocol: "zookeeper"
- timeout: "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
-
-# reference config
-references:
- "UserProvider":
- registry: "demoZk"
- protocol: "dubbo"
- interface: "org.apache.dubbo.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
-
-# protocol config
-protocol_conf:
- dubbo:
- reconnect_interval: 0
- connection_number: 1
- heartbeat_period: "5s"
- session_timeout: "180s"
- pool_size: 64
- pool_ttl: 600
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_rq_size: 1024
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024000
- session_name: "client"
+dubbo:
+ registries:
+ "demoZK":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+ consumer:
+ registry:
+ - demoZK
+ references:
+ "greeterImpl":
+ protocol: "tri"
+ interface: "protobuf.Greeter" # must be compatible with grpc or dubbo-java
\ No newline at end of file
diff --git a/helloworld/go-client/conf/log.yml b/helloworld/go-client/conf/log.yml
deleted file mode 100644
index 2b6e93a..0000000
--- a/helloworld/go-client/conf/log.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-level: "debug"
-development: true
-disableCaller: false
-disableStacktrace: false
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capital"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/helloworld/go-server/cmd/server.go b/helloworld/go-server/cmd/server.go
index 5fe60e0..68ac7ac 100644
--- a/helloworld/go-server/cmd/server.go
+++ b/helloworld/go-server/cmd/server.go
@@ -18,63 +18,22 @@
package main
import (
- "fmt"
- "os"
- "os/signal"
- "syscall"
- "time"
-)
-
-import (
- _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster_impl"
- _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance"
- "dubbo.apache.org/dubbo-go/v3/common/logger"
_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
- _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
+ _ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
_ "dubbo.apache.org/dubbo-go/v3/registry/protocol"
_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
-
- hessian "github.com/apache/dubbo-go-hessian2"
)
import (
"github.com/apache/dubbo-go-samples/helloworld/go-server/pkg"
)
-var (
- survivalTimeout = int(3e9)
-)
-
-// need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run
+// deprecated: need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run
+// config.Load(config.Path("..."))
func main() {
- hessian.RegisterPOJO(&pkg.User{})
- config.SetProviderService(new(pkg.UserProvider))
+ config.SetProviderService(pkg.NewGreeterProvider())
config.Load()
-
- initSignal()
-}
-
-func initSignal() {
- signals := make(chan os.Signal, 1)
- // It is not possible to block SIGKILL or syscall.SIGSTOP
- signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
- for {
- sig := <-signals
- logger.Infof("get signal %s", sig.String())
- switch sig {
- case syscall.SIGHUP:
- // reload()
- default:
- time.AfterFunc(time.Duration(survivalTimeout), func() {
- logger.Warnf("app exit now by force...")
- os.Exit(1)
- })
-
- // The program exits normally or timeout forcibly exits.
- fmt.Println("provider app exit now...")
- return
- }
- }
+ select {}
}
diff --git a/helloworld/go-server/conf/client.yml b/helloworld/go-server/conf/client.yml
deleted file mode 100644
index 11ae382..0000000
--- a/helloworld/go-server/conf/client.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-# dubbo client yaml configure file
-
-check: true
-# client
-request_timeout: "3s"
-# connect timeout
-connect_timeout: "3s"
-
-# application config
-application:
- organization: "dubbo.io"
- name: "UserInfoTest"
- module: "dubbo-go user-info client"
- version: "0.0.1"
- environment: "dev"
-
-# registry config
-registries:
- "demoZk":
- protocol: "zookeeper"
- timeout: "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
-
-# reference config
-references:
- "UserProvider":
- registry: "demoZk"
- protocol: "dubbo"
- interface: "org.apache.dubbo.UserProvider"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 3
-
-# protocol config
-protocol_conf:
- dubbo:
- reconnect_interval: 0
- connection_number: 1
- heartbeat_period: "5s"
- session_timeout: "180s"
- pool_size: 64
- pool_ttl: 600
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_rq_size: 1024
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024000
- session_name: "client"
diff --git a/helloworld/go-server/conf/log.yml b/helloworld/go-server/conf/log.yml
deleted file mode 100644
index 970d988..0000000
--- a/helloworld/go-server/conf/log.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-level: "error"
-development: true
-disableCaller: false
-disableStacktrace: false
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capital"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/helloworld/go-server/conf/server.yml b/helloworld/go-server/conf/server.yml
index af90434..a435688 100644
--- a/helloworld/go-server/conf/server.yml
+++ b/helloworld/go-server/conf/server.yml
@@ -1,55 +1,17 @@
-# dubbo server yaml configure file
-
-# application config
-application:
- organization: "dubbo.io"
- name: "UserInfoServer"
- module: "dubbo-go user-info server"
- version: "0.0.1"
- environment: "dev"
-
-# registry config
-registries:
- "demoZk":
- protocol: "zookeeper"
- timeout: "3s"
- address: "127.0.0.1:2181"
-
-# service config
-services:
- "UserProvider":
- registry: "demoZk"
- protocol: "dubbo"
- interface: "org.apache.dubbo.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "GetUser"
- retries: 1
- loadbalance: "random"
-
-# protocol config
-protocols:
- "dubbo":
- name: "dubbo"
- port: 20000
-
-protocol_conf:
- dubbo:
- session_number: 700
- session_timeout: "180s"
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_rq_size: 1024
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024000
- session_name: "server"
+dubbo:
+ registries:
+ "demoZK":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+ protocols:
+ "triple":
+ name: "tri"
+ port: 20000
+ provider:
+ registry:
+ - demoZK
+ services:
+ "greeterImpl":
+ protocol: "triple"
+ interface: "protobuf.Greeter" # must be compatible with grpc or dubbo-java
\ No newline at end of file
diff --git a/helloworld/go-server/docker/docker-health-check.sh b/helloworld/go-server/docker/docker-health-check.sh
deleted file mode 100644
index 2cc32c2..0000000
--- a/helloworld/go-server/docker/docker-health-check.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-curl 127.0.0.1:2181
-res=$?
-passCode=52
-while [ "$res" != "$passCode" ];do
- sleep 5
- curl 127.0.0.1:2181
- res=$?
-done
-
-sleep 5
diff --git a/helloworld/go-server/pkg/greeter.go b/helloworld/go-server/pkg/greeter.go
new file mode 100644
index 0000000..08b393a
--- /dev/null
+++ b/helloworld/go-server/pkg/greeter.go
@@ -0,0 +1,45 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package pkg
+
+import (
+ "context"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/common/logger"
+)
+
+import (
+ pb "github.com/apache/dubbo-go-samples/helloworld/protobuf"
+)
+
+type GreeterProvider struct {
+ *pb.GreeterProviderBase
+}
+
+func NewGreeterProvider() *GreeterProvider {
+ return &GreeterProvider{
+ GreeterProviderBase: &pb.GreeterProviderBase{},
+ }
+}
+
+func (s *GreeterProvider) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.User, error) {
+ logger.Infof("Dubbo3 GreeterProvider get user name = %s\n", in.Name)
+ return &pb.User{Name: "Hello " + in.Name, Id: "12345", Age: 21}, nil
+}
diff --git a/helloworld/go-server/pkg/user.go b/helloworld/go-server/pkg/user.go
deleted file mode 100644
index 8e34bf0..0000000
--- a/helloworld/go-server/pkg/user.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package pkg
-
-import (
- "context"
- "time"
-)
-
-import (
- "github.com/dubbogo/gost/log"
-)
-
-type User struct {
- ID string
- Name string
- Age int32
- Time time.Time
-}
-
-type UserProvider struct {
-}
-
-func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
- gxlog.CInfo("req:%#v", req)
- rsp := User{"A001", "Alex Stocks", 18, time.Now()}
- gxlog.CInfo("rsp:%#v", rsp)
- return &rsp, nil
-}
-
-func (u *UserProvider) Reference() string {
- return "UserProvider"
-}
-
-func (u User) JavaClassName() string {
- return "org.apache.dubbo.User"
-}
diff --git a/helloworld/go-server/tests/integration/main_test.go b/helloworld/go-server/tests/integration/main_test.go
index d028c55..c739d6c 100644
--- a/helloworld/go-server/tests/integration/main_test.go
+++ b/helloworld/go-server/tests/integration/main_test.go
@@ -20,7 +20,6 @@
package integration
import (
- "context"
"os"
"testing"
"time"
@@ -36,36 +35,18 @@ import (
_ "dubbo.apache.org/dubbo-go/v3/protocol/dubbo"
_ "dubbo.apache.org/dubbo-go/v3/registry/protocol"
_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
+)
- hessian "github.com/apache/dubbo-go-hessian2"
+import (
+ dubbo3pb "github.com/apache/dubbo-go-samples/helloworld/protobuf"
)
-var userProvider = new(UserProvider)
+var greeterProvider = new(dubbo3pb.GreeterClientImpl)
func TestMain(m *testing.M) {
- config.SetConsumerService(userProvider)
- hessian.RegisterPOJO(&User{})
+ config.SetConsumerService(greeterProvider)
config.Load()
time.Sleep(3 * time.Second)
os.Exit(m.Run())
}
-
-type User struct {
- ID string
- Name string
- Age int32
- Time time.Time
-}
-
-type UserProvider struct {
- GetUser func(ctx context.Context, req []interface{}, rsp *User) error
-}
-
-func (u *UserProvider) Reference() string {
- return "UserProvider"
-}
-
-func (User) JavaClassName() string {
- return "org.apache.dubbo.User"
-}
diff --git a/helloworld/go-server/tests/integration/userprovider_test.go b/helloworld/go-server/tests/integration/userprovider_test.go
index 7183e64..01a7855 100644
--- a/helloworld/go-server/tests/integration/userprovider_test.go
+++ b/helloworld/go-server/tests/integration/userprovider_test.go
@@ -28,12 +28,24 @@ import (
"github.com/stretchr/testify/assert"
)
-func TestGetUser(t *testing.T) {
- user := &User{}
- err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
+import (
+ dubbo3pb "github.com/apache/dubbo-go-samples/helloworld/protobuf"
+)
+
+func TestSayHello(t *testing.T) {
+ req := &dubbo3pb.HelloRequest{
+ Name: "laurence",
+ }
+
+ reply := &dubbo3pb.User{}
+
+ ctx := context.Background()
+ ctx = context.WithValue(ctx, "tri-req-id", "test_value_XXXXXXXX")
+
+ err := greeterProvider.SayHello(ctx, req, reply)
+
assert.Nil(t, err)
- assert.Equal(t, "A001", user.ID)
- assert.Equal(t, "Alex Stocks", user.Name)
- assert.Equal(t, int32(18), user.Age)
- assert.NotNil(t, user.Time)
+ assert.Equal(t, "Hello laurence", reply.Name)
+ assert.Equal(t, "12345", reply.Id)
+ assert.Equal(t, int32(21), reply.Age)
}
diff --git a/helloworld/java-client/build.sh b/helloworld/java-client/build.sh
deleted file mode 100644
index c869acf..0000000
--- a/helloworld/java-client/build.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# rm src/main/resources/META-INF/spring/dubbo.consumer.xml
-# cp src/main/resources/META-INF/spring/dubbo-protocol.consumer.xml src/main/resources/META-INF/spring/dubbo.consumer.xml
-# cp src/main/resources/META-INF/spring/jsonrpc-protocol.consumer.xml src/main/resources/META-INF/spring/dubbo.consumer.xml
-mvn clean package -Dmaven.test.skip
diff --git a/helloworld/java-client/build/generated/source/proto/main/java/org/apache/dubbo/sample/hello/Helloworld.java b/helloworld/java-client/build/generated/source/proto/main/java/org/apache/dubbo/sample/hello/Helloworld.java
new file mode 100644
index 0000000..99758ac
--- /dev/null
+++ b/helloworld/java-client/build/generated/source/proto/main/java/org/apache/dubbo/sample/hello/Helloworld.java
@@ -0,0 +1,1432 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: helloworld.proto
+
+package org.apache.dubbo.sample.hello;
+
+public final class Helloworld {
+ private Helloworld() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistryLite registry) {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registerAllExtensions(
+ (com.google.protobuf.ExtensionRegistryLite) registry);
+ }
+ public interface HelloRequestOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:helloworld.HelloRequest)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ java.lang.String getName();
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ com.google.protobuf.ByteString
+ getNameBytes();
+ }
+ /**
+ * <pre>
+ * The request message containing the user's name.
+ * </pre>
+ *
+ * Protobuf type {@code helloworld.HelloRequest}
+ */
+ public static final class HelloRequest extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:helloworld.HelloRequest)
+ HelloRequestOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use HelloRequest.newBuilder() to construct.
+ private HelloRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
+ super(builder);
+ }
+ private HelloRequest() {
+ name_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new HelloRequest();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private HelloRequest(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ name_ = s;
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_HelloRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_HelloRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest.class, org.apache.dubbo.sample.hello.Helloworld.HelloRequest.Builder.class);
+ }
+
+ public static final int NAME_FIELD_NUMBER = 1;
+ private volatile java.lang.Object name_;
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ @java.lang.Override
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!getNameBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!getNameBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.dubbo.sample.hello.Helloworld.HelloRequest)) {
+ return super.equals(obj);
+ }
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest other = (org.apache.dubbo.sample.hello.Helloworld.HelloRequest) obj;
+
+ if (!getName()
+ .equals(other.getName())) return false;
+ if (!unknownFields.equals(other.unknownFields)) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + NAME_FIELD_NUMBER;
+ hash = (53 * hash) + getName().hashCode();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(org.apache.dubbo.sample.hello.Helloworld.HelloRequest prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * <pre>
+ * The request message containing the user's name.
+ * </pre>
+ *
+ * Protobuf type {@code helloworld.HelloRequest}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
+ // @@protoc_insertion_point(builder_implements:helloworld.HelloRequest)
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_HelloRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_HelloRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest.class, org.apache.dubbo.sample.hello.Helloworld.HelloRequest.Builder.class);
+ }
+
+ // Construct using org.apache.dubbo.sample.hello.Helloworld.HelloRequest.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ name_ = "";
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_HelloRequest_descriptor;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.HelloRequest getDefaultInstanceForType() {
+ return org.apache.dubbo.sample.hello.Helloworld.HelloRequest.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.HelloRequest build() {
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.HelloRequest buildPartial() {
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest result = new org.apache.dubbo.sample.hello.Helloworld.HelloRequest(this);
+ result.name_ = name_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.dubbo.sample.hello.Helloworld.HelloRequest) {
+ return mergeFrom((org.apache.dubbo.sample.hello.Helloworld.HelloRequest)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.dubbo.sample.hello.Helloworld.HelloRequest other) {
+ if (other == org.apache.dubbo.sample.hello.Helloworld.HelloRequest.getDefaultInstance()) return this;
+ if (!other.getName().isEmpty()) {
+ name_ = other.name_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.dubbo.sample.hello.Helloworld.HelloRequest) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ private java.lang.Object name_ = "";
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @param value The name to set.
+ * @return This builder for chaining.
+ */
+ public Builder setName(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return This builder for chaining.
+ */
+ public Builder clearName() {
+
+ name_ = getDefaultInstance().getName();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @param value The bytes for name to set.
+ * @return This builder for chaining.
+ */
+ public Builder setNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:helloworld.HelloRequest)
+ }
+
+ // @@protoc_insertion_point(class_scope:helloworld.HelloRequest)
+ private static final org.apache.dubbo.sample.hello.Helloworld.HelloRequest DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new org.apache.dubbo.sample.hello.Helloworld.HelloRequest();
+ }
+
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser<HelloRequest>
+ PARSER = new com.google.protobuf.AbstractParser<HelloRequest>() {
+ @java.lang.Override
+ public HelloRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new HelloRequest(input, extensionRegistry);
+ }
+ };
+
+ public static com.google.protobuf.Parser<HelloRequest> parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<HelloRequest> getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.HelloRequest getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ }
+
+ public interface UserOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:helloworld.User)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ java.lang.String getName();
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ com.google.protobuf.ByteString
+ getNameBytes();
+
+ /**
+ * <code>string id = 2;</code>
+ * @return The id.
+ */
+ java.lang.String getId();
+ /**
+ * <code>string id = 2;</code>
+ * @return The bytes for id.
+ */
+ com.google.protobuf.ByteString
+ getIdBytes();
+
+ /**
+ * <code>int32 age = 3;</code>
+ * @return The age.
+ */
+ int getAge();
+ }
+ /**
+ * <pre>
+ * The response message containing the greetings
+ * </pre>
+ *
+ * Protobuf type {@code helloworld.User}
+ */
+ public static final class User extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:helloworld.User)
+ UserOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use User.newBuilder() to construct.
+ private User(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
+ super(builder);
+ }
+ private User() {
+ name_ = "";
+ id_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new User();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private User(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ name_ = s;
+ break;
+ }
+ case 18: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ id_ = s;
+ break;
+ }
+ case 24: {
+
+ age_ = input.readInt32();
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_User_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_User_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.dubbo.sample.hello.Helloworld.User.class, org.apache.dubbo.sample.hello.Helloworld.User.Builder.class);
+ }
+
+ public static final int NAME_FIELD_NUMBER = 1;
+ private volatile java.lang.Object name_;
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ @java.lang.Override
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int ID_FIELD_NUMBER = 2;
+ private volatile java.lang.Object id_;
+ /**
+ * <code>string id = 2;</code>
+ * @return The id.
+ */
+ @java.lang.Override
+ public java.lang.String getId() {
+ java.lang.Object ref = id_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ id_ = s;
+ return s;
+ }
+ }
+ /**
+ * <code>string id = 2;</code>
+ * @return The bytes for id.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getIdBytes() {
+ java.lang.Object ref = id_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ id_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int AGE_FIELD_NUMBER = 3;
+ private int age_;
+ /**
+ * <code>int32 age = 3;</code>
+ * @return The age.
+ */
+ @java.lang.Override
+ public int getAge() {
+ return age_;
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!getNameBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
+ }
+ if (!getIdBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 2, id_);
+ }
+ if (age_ != 0) {
+ output.writeInt32(3, age_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!getNameBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
+ }
+ if (!getIdBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, id_);
+ }
+ if (age_ != 0) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(3, age_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.dubbo.sample.hello.Helloworld.User)) {
+ return super.equals(obj);
+ }
+ org.apache.dubbo.sample.hello.Helloworld.User other = (org.apache.dubbo.sample.hello.Helloworld.User) obj;
+
+ if (!getName()
+ .equals(other.getName())) return false;
+ if (!getId()
+ .equals(other.getId())) return false;
+ if (getAge()
+ != other.getAge()) return false;
+ if (!unknownFields.equals(other.unknownFields)) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + NAME_FIELD_NUMBER;
+ hash = (53 * hash) + getName().hashCode();
+ hash = (37 * hash) + ID_FIELD_NUMBER;
+ hash = (53 * hash) + getId().hashCode();
+ hash = (37 * hash) + AGE_FIELD_NUMBER;
+ hash = (53 * hash) + getAge();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(org.apache.dubbo.sample.hello.Helloworld.User prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * <pre>
+ * The response message containing the greetings
+ * </pre>
+ *
+ * Protobuf type {@code helloworld.User}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
+ // @@protoc_insertion_point(builder_implements:helloworld.User)
+ org.apache.dubbo.sample.hello.Helloworld.UserOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_User_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_User_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.dubbo.sample.hello.Helloworld.User.class, org.apache.dubbo.sample.hello.Helloworld.User.Builder.class);
+ }
+
+ // Construct using org.apache.dubbo.sample.hello.Helloworld.User.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ name_ = "";
+
+ id_ = "";
+
+ age_ = 0;
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_User_descriptor;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.User getDefaultInstanceForType() {
+ return org.apache.dubbo.sample.hello.Helloworld.User.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.User build() {
+ org.apache.dubbo.sample.hello.Helloworld.User result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.User buildPartial() {
+ org.apache.dubbo.sample.hello.Helloworld.User result = new org.apache.dubbo.sample.hello.Helloworld.User(this);
+ result.name_ = name_;
+ result.id_ = id_;
+ result.age_ = age_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.dubbo.sample.hello.Helloworld.User) {
+ return mergeFrom((org.apache.dubbo.sample.hello.Helloworld.User)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.dubbo.sample.hello.Helloworld.User other) {
+ if (other == org.apache.dubbo.sample.hello.Helloworld.User.getDefaultInstance()) return this;
+ if (!other.getName().isEmpty()) {
+ name_ = other.name_;
+ onChanged();
+ }
+ if (!other.getId().isEmpty()) {
+ id_ = other.id_;
+ onChanged();
+ }
+ if (other.getAge() != 0) {
+ setAge(other.getAge());
+ }
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.dubbo.sample.hello.Helloworld.User parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.dubbo.sample.hello.Helloworld.User) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ private java.lang.Object name_ = "";
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @param value The name to set.
+ * @return This builder for chaining.
+ */
+ public Builder setName(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return This builder for chaining.
+ */
+ public Builder clearName() {
+
+ name_ = getDefaultInstance().getName();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @param value The bytes for name to set.
+ * @return This builder for chaining.
+ */
+ public Builder setNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object id_ = "";
+ /**
+ * <code>string id = 2;</code>
+ * @return The id.
+ */
+ public java.lang.String getId() {
+ java.lang.Object ref = id_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ id_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>string id = 2;</code>
+ * @return The bytes for id.
+ */
+ public com.google.protobuf.ByteString
+ getIdBytes() {
+ java.lang.Object ref = id_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ id_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>string id = 2;</code>
+ * @param value The id to set.
+ * @return This builder for chaining.
+ */
+ public Builder setId(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ id_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string id = 2;</code>
+ * @return This builder for chaining.
+ */
+ public Builder clearId() {
+
+ id_ = getDefaultInstance().getId();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string id = 2;</code>
+ * @param value The bytes for id to set.
+ * @return This builder for chaining.
+ */
+ public Builder setIdBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ id_ = value;
+ onChanged();
+ return this;
+ }
+
+ private int age_ ;
+ /**
+ * <code>int32 age = 3;</code>
+ * @return The age.
+ */
+ @java.lang.Override
+ public int getAge() {
+ return age_;
+ }
+ /**
+ * <code>int32 age = 3;</code>
+ * @param value The age to set.
+ * @return This builder for chaining.
+ */
+ public Builder setAge(int value) {
+
+ age_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>int32 age = 3;</code>
+ * @return This builder for chaining.
+ */
+ public Builder clearAge() {
+
+ age_ = 0;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:helloworld.User)
+ }
+
+ // @@protoc_insertion_point(class_scope:helloworld.User)
+ private static final org.apache.dubbo.sample.hello.Helloworld.User DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new org.apache.dubbo.sample.hello.Helloworld.User();
+ }
+
+ public static org.apache.dubbo.sample.hello.Helloworld.User getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser<User>
+ PARSER = new com.google.protobuf.AbstractParser<User>() {
+ @java.lang.Override
+ public User parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new User(input, extensionRegistry);
+ }
+ };
+
+ public static com.google.protobuf.Parser<User> parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<User> getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.User getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ }
+
+ private static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_helloworld_HelloRequest_descriptor;
+ private static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_helloworld_HelloRequest_fieldAccessorTable;
+ private static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_helloworld_User_descriptor;
+ private static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_helloworld_User_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\020helloworld.proto\022\nhelloworld\"\034\n\014HelloR" +
+ "equest\022\014\n\004name\030\001 \001(\t\"-\n\004User\022\014\n\004name\030\001 \001" +
+ "(\t\022\n\n\002id\030\002 \001(\t\022\013\n\003age\030\003 \001(\005B\037\n\035org.apach" +
+ "e.dubbo.sample.hellob\006proto3"
+ };
+ descriptor = com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ });
+ internal_static_helloworld_HelloRequest_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_helloworld_HelloRequest_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_helloworld_HelloRequest_descriptor,
+ new java.lang.String[] { "Name", });
+ internal_static_helloworld_User_descriptor =
+ getDescriptor().getMessageTypes().get(1);
+ internal_static_helloworld_User_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_helloworld_User_descriptor,
+ new java.lang.String[] { "Name", "Id", "Age", });
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/helloworld/java-client/pom.xml b/helloworld/java-client/pom.xml
index 1a333b9..10ae5bb 100644
--- a/helloworld/java-client/pom.xml
+++ b/helloworld/java-client/pom.xml
@@ -1,230 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
-
- <groupId>com.ikurento</groupId>
- <artifactId>user-info-client</artifactId>
- <packaging>jar</packaging>
- <version>0.2.0</version>
- <description>The demo consumer module of dubbo project</description>
+ <groupId>com.apache.dubbogo</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>dubbo-samples-triple-client</artifactId>
<properties>
- <skip_maven_deploy>false</skip_maven_deploy>
-
- <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
- <dubbo-version>2.6.5</dubbo-version>
+ <source.level>1.8</source.level>
+ <target.level>1.8</target.level>
+ <dubbo.version>3.0.0</dubbo.version>
+ <junit.version>4.12</junit.version>
+ <spring-test.version>4.3.16.RELEASE</spring-test.version>
+ <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+ <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
+ <spring-boot.version>1.5.13.RELEASE</spring-boot.version>
+ <grpc.version>1.19.0</grpc.version>
+ <protoc.version>3.7.1</protoc.version>
</properties>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo-dependencies-bom</artifactId>
- <version>${dubbo-version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<dependencies>
<dependency>
- <groupId>com.qianmi</groupId>
- <artifactId>dubbo-rpc-jsonrpc</artifactId>
- <version>${dubbo-jsonrpc-version}</version>
- </dependency>
- <dependency>
- <groupId>com.alibaba</groupId>
+ <groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>2.12.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.20.0-GA</version>
+ <version>${dubbo.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.netty</groupId>
- <artifactId>netty</artifactId>
- <version>3.2.5.Final</version>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>3.14.0</version>
</dependency>
<dependency>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-core</artifactId>
- <version>1.1.7</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.grizzly</groupId>
- <artifactId>grizzly-core</artifactId>
- <version>2.1.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.7</version>
- </dependency>
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>fastjson</artifactId>
- <version>1.2.56</version>
- </dependency>
- <dependency>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- <version>1.4.7</version>
- </dependency>
- <dependency>
- <groupId>org.apache.bsf</groupId>
- <artifactId>bsf-api</artifactId>
- <version>3.1</version>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
- <version>3.4.14</version>
- </dependency>
- <dependency>
- <groupId>com.github.sgroschupf</groupId>
- <artifactId>zkclient</artifactId>
- <version>0.1</version>
- </dependency>
- <dependency>
- <groupId>com.netflix.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>1.1.16</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.xmemcached</groupId>
- <artifactId>xmemcached</artifactId>
- <version>1.3.6</version>
+ <version>3.4.8</version>
</dependency>
<dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-simple</artifactId>
- <version>2.6.1</version>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http</artifactId>
- <version>2.6.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- <version>0.12.0</version>
- </dependency>
- <dependency>
- <groupId>com.caucho</groupId>
- <artifactId>hessian</artifactId>
- <version>4.0.7</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.26</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.16</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.6.2</version>
- </dependency>
- <dependency>
- <groupId>redis.clients</groupId>
- <artifactId>jedis</artifactId>
- <version>2.1.0</version>
- </dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <version>1.0.0.GA</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.2.0.Final</version>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring-test.version}</version>
+ <scope>test</scope>
</dependency>
+
<dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- <version>0.4</version>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>testcontainers</artifactId>
+ <version>1.12.3</version>
+ <scope>test</scope>
</dependency>
</dependencies>
+
+ <profiles>
+ <!-- For jdk 11 above JavaEE annotation -->
+ <profile>
+ <id>javax.annotation</id>
+ <activation>
+ <jdk>[1.11,)</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
<build>
+ <extensions>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ <version>1.6.1</version>
+ </extension>
+ </extensions>
<plugins>
<plugin>
- <artifactId>maven-dependency-plugin</artifactId>
+ <groupId>org.xolstice.maven.plugins</groupId>
+ <artifactId>protobuf-maven-plugin</artifactId>
+ <version>0.6.1</version>
+ <configuration>
+ <protocArtifact>com.google.protobuf:protoc:3.17.3:exe:${os.detected.classifier}</protocArtifact>
+ <pluginId>triple-java</pluginId>
+ <outputDirectory>build/generated/source/proto/main/java</outputDirectory>
+ </configuration>
<executions>
<execution>
- <id>unpack</id>
- <phase>package</phase>
<goals>
- <goal>unpack</goal>
+ <goal>compile</goal>
+ <goal>test-compile</goal>
</goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- <outputDirectory>${project.build.directory}/dubbo</outputDirectory>
- <includes>META-INF/assembly/**</includes>
- </artifactItem>
- </artifactItems>
- </configuration>
</execution>
</executions>
</plugin>
<plugin>
- <artifactId>maven-assembly-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
<configuration>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
+ <source>${source.level}</source>
+ <target>${target.level}</target>
</configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
- <id>make-assembly</id>
- <phase>package</phase>
+ <phase>generate-sources</phase>
<goals>
- <goal>single</goal>
+ <goal>add-source</goal>
</goals>
+ <configuration>
+ <sources>
+ <source>build/generated/source/proto/main/java</source>
+ </sources>
+ </configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
-</project>
+
+</project>
\ No newline at end of file
diff --git a/helloworld/java-client/run.sh b/helloworld/java-client/run.sh
new file mode 100644
index 0000000..5152f3a
--- /dev/null
+++ b/helloworld/java-client/run.sh
@@ -0,0 +1,2 @@
+mvn install -DSkipTests
+mvn exec:java -Dexec.mainClass="com.apache.dubbo.sample.basic.ApiConsumer"
\ No newline at end of file
diff --git a/helloworld/java-client/src/main/assembly/assembly.xml b/helloworld/java-client/src/main/assembly/assembly.xml
deleted file mode 100644
index 21c6863..0000000
--- a/helloworld/java-client/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<assembly>
- <id>assembly</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${project.build.directory}/dubbo/META-INF/assembly/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <fileMode>0755</fileMode>
- </fileSet>
- <fileSet>
- <directory>src/main/resources</directory>
- <includes>
- <include>dubbo.properties</include>
- <include>log4j.*</include>
- </includes>
- <outputDirectory>conf</outputDirectory>
- <fileMode>0644</fileMode>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- </dependencySet>
- </dependencySets>
-</assembly>
\ No newline at end of file
diff --git a/helloworld/java-client/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java b/helloworld/java-client/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java
new file mode 100644
index 0000000..71e5f2a
--- /dev/null
+++ b/helloworld/java-client/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.apache.dubbo.sample.basic;
+
+import org.apache.dubbo.common.constants.CommonConstants;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.sample.hello.Helloworld;
+
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+public class ApiConsumer {
+ public static void main(String[] args) throws InterruptedException, IOException {
+ ReferenceConfig<IGreeter> ref = new ReferenceConfig<>();
+ ref.setInterface(IGreeter.class);
+ ref.setCheck(false);
+ ref.setProtocol(CommonConstants.TRIPLE);
+ ref.setLazy(true);
+ ref.setTimeout(100000);
+ ref.setApplication(new ApplicationConfig("demo-consumer"));
+ ref.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
+ final IGreeter iGreeter = ref.get();
+
+ System.out.println("dubbo ref started");
+ Helloworld.HelloRequest req = Helloworld.HelloRequest.newBuilder().setName("laurence").build();
+ try {
+ final Helloworld.User reply = iGreeter.sayHello(req);
+ TimeUnit.SECONDS.sleep(1);
+ System.out.println("Reply:" + reply);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ System.in.read();
+ }
+}
diff --git a/helloworld/java-client/src/main/java/com/apache/dubbo/sample/basic/IGreeter.java b/helloworld/java-client/src/main/java/com/apache/dubbo/sample/basic/IGreeter.java
new file mode 100644
index 0000000..8722f2c
--- /dev/null
+++ b/helloworld/java-client/src/main/java/com/apache/dubbo/sample/basic/IGreeter.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.apache.dubbo.sample.basic;
+
+
+import org.apache.dubbo.sample.hello.Helloworld;
+
+public interface IGreeter {
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ Helloworld.User sayHello(Helloworld.HelloRequest request);
+
+}
diff --git a/helloworld/java-client/src/main/java/org/apache/dubbo/Consumer.java b/helloworld/java-client/src/main/java/org/apache/dubbo/Consumer.java
deleted file mode 100644
index 0183a67..0000000
--- a/helloworld/java-client/src/main/java/org/apache/dubbo/Consumer.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dubbo;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-
-public class Consumer {
- // Define a private variable (Required in Spring)
- private UserProvider userProvider;
-
- // Spring DI (Required in Spring)
- public void setUserProvider(UserProvider u) {
- this.userProvider = u;
- }
-
- public static void main(String[] args) {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.consumer.xml","META-INF/spring/service.xml");
- context.start();
- context.getBean(Consumer.class).start();
- }
-
- // Start the entry function for consumer (Specified in the configuration file)
- public void start() {
- System.out.println("\n\ntest");
- testGetUser();
- }
-
- private void testGetUser() {
- try {
- User user1 = userProvider.GetUser("A003");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user1.getID() + ", name:" + user1.getName()
- + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString());
-
- } catch (Exception e) {
- System.out.println("*************exception***********");
- e.printStackTrace();
- }
- }
-
-}
diff --git a/helloworld/java-client/src/main/java/org/apache/dubbo/User.java b/helloworld/java-client/src/main/java/org/apache/dubbo/User.java
deleted file mode 100644
index 36d1b9c..0000000
--- a/helloworld/java-client/src/main/java/org/apache/dubbo/User.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dubbo;
-
-import java.util.Date;
-
-public class User {
-
- private String id;
-
- private String name;
-
- private int age;
-
- private Date time = new Date();
-
-
- public User() {
- }
-
-
- public User(String id, String name, int age) {
- this.id = id;
- this.name = name;
- this.age = age;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public Date getTime() {
- return time;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
-
-}
diff --git a/helloworld/java-client/src/main/java/org/apache/dubbo/UserProvider.java b/helloworld/java-client/src/main/java/org/apache/dubbo/UserProvider.java
deleted file mode 100644
index c719124..0000000
--- a/helloworld/java-client/src/main/java/org/apache/dubbo/UserProvider.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo;
-
-public interface UserProvider {
- User GetUser(String userId);
-}
diff --git a/helloworld/java-client/src/main/proto/helloworld.proto b/helloworld/java-client/src/main/proto/helloworld.proto
new file mode 100644
index 0000000..ee6ca29
--- /dev/null
+++ b/helloworld/java-client/src/main/proto/helloworld.proto
@@ -0,0 +1,28 @@
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+syntax = "proto3";
+
+option java_package = "org.apache.dubbo.sample.hello";
+
+package helloworld;
+
+// The request message containing the user's name.
+message HelloRequest {
+ string name = 1;
+}
+
+// The response message containing the greetings
+message User {
+ string name = 1;
+ string id = 2;
+ int32 age = 3;
+}
diff --git a/helloworld/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml b/helloworld/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
deleted file mode 100644
index 95fdcb8..0000000
--- a/helloworld/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
-
- <!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
- <dubbo:application name="user-info-client"/>
- <!-- 连接到哪个本地注册中心 -->
- <dubbo:registry id="demoZk" address="zookeeper://127.0.0.1:2181"/>
- <!-- dubbo.registry.address from dubbo.properties -->
- <!-- dubbo:registry address="${dubbo.registry.address}" / -->
-
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol id="dubbo" name="dubbo"/>
- <dubbo:protocol id="jsonrpc" name="jsonrpc"/>
-
- <!-- 声明需要使用的服务接口 -->
- <dubbo:reference registry="demoZk" check="false" id="userProvider" protocol="dubbo"
- interface="org.apache.dubbo.UserProvider">
- <!--<dubbo:parameter key="heartbeat" value="10000"/ -->
- </dubbo:reference>
-</beans>
diff --git a/helloworld/java-client/src/main/resources/META-INF/spring/service.xml b/helloworld/java-client/src/main/resources/META-INF/spring/service.xml
deleted file mode 100644
index bdcc57f..0000000
--- a/helloworld/java-client/src/main/resources/META-INF/spring/service.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.dubbo.Consumer" init-method="start">
- <!-- 声明这个类 要使用的服务名-->
- <property name="userProvider" ref="userProvider"/>
- </bean>
-
-</beans>
diff --git a/helloworld/java-client/src/main/resources/dubbo.properties b/helloworld/java-client/src/main/resources/dubbo.properties
deleted file mode 100644
index 5ae386d..0000000
--- a/helloworld/java-client/src/main/resources/dubbo.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-### dubboע���������� ###
-dubbo.container=log4j,spring
-dubbo.application.name=user-info-client
-dubbo.application.owner=AlexStocks
-dubbo.application.environment=product
-dubbo.registry.address=zookeeper://127.0.0.1:2181
-dubbo.monitor.protocol=zookeeper
-dubbo.consumer.timeout=10000
-dubbo.provider.timeout=10000
-dubbo.protocol.name=dubbo
-dubbo.log4j.file=logs/client.log
-dubbo.log4j.level=WARN
diff --git a/helloworld/java-client/src/main/resources/log4j.properties b/helloworld/java-client/src/main/resources/log4j.properties
index 02748ae..6b82aba 100644
--- a/helloworld/java-client/src/main/resources/log4j.properties
+++ b/helloworld/java-client/src/main/resources/log4j.properties
@@ -1,16 +1,26 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-log4j.rootLogger=DEBUG, file, console
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+###set log levels###
+log4j.rootLogger=debug, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/helloworld/java-server/build.sh b/helloworld/java-server/build.sh
deleted file mode 100644
index 7b5755b..0000000
--- a/helloworld/java-server/build.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# mvn dependency:sources
-mvn clean package -Dmaven.test.skip
-# mvn -X clean compile package -DskipTests=true
diff --git a/helloworld/java-server/build/generated/source/proto/main/java/org/apache/dubbo/sample/hello/Helloworld.java b/helloworld/java-server/build/generated/source/proto/main/java/org/apache/dubbo/sample/hello/Helloworld.java
new file mode 100644
index 0000000..99758ac
--- /dev/null
+++ b/helloworld/java-server/build/generated/source/proto/main/java/org/apache/dubbo/sample/hello/Helloworld.java
@@ -0,0 +1,1432 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: helloworld.proto
+
+package org.apache.dubbo.sample.hello;
+
+public final class Helloworld {
+ private Helloworld() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistryLite registry) {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registerAllExtensions(
+ (com.google.protobuf.ExtensionRegistryLite) registry);
+ }
+ public interface HelloRequestOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:helloworld.HelloRequest)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ java.lang.String getName();
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ com.google.protobuf.ByteString
+ getNameBytes();
+ }
+ /**
+ * <pre>
+ * The request message containing the user's name.
+ * </pre>
+ *
+ * Protobuf type {@code helloworld.HelloRequest}
+ */
+ public static final class HelloRequest extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:helloworld.HelloRequest)
+ HelloRequestOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use HelloRequest.newBuilder() to construct.
+ private HelloRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
+ super(builder);
+ }
+ private HelloRequest() {
+ name_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new HelloRequest();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private HelloRequest(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ name_ = s;
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_HelloRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_HelloRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest.class, org.apache.dubbo.sample.hello.Helloworld.HelloRequest.Builder.class);
+ }
+
+ public static final int NAME_FIELD_NUMBER = 1;
+ private volatile java.lang.Object name_;
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ @java.lang.Override
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!getNameBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!getNameBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.dubbo.sample.hello.Helloworld.HelloRequest)) {
+ return super.equals(obj);
+ }
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest other = (org.apache.dubbo.sample.hello.Helloworld.HelloRequest) obj;
+
+ if (!getName()
+ .equals(other.getName())) return false;
+ if (!unknownFields.equals(other.unknownFields)) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + NAME_FIELD_NUMBER;
+ hash = (53 * hash) + getName().hashCode();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(org.apache.dubbo.sample.hello.Helloworld.HelloRequest prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * <pre>
+ * The request message containing the user's name.
+ * </pre>
+ *
+ * Protobuf type {@code helloworld.HelloRequest}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
+ // @@protoc_insertion_point(builder_implements:helloworld.HelloRequest)
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_HelloRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_HelloRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest.class, org.apache.dubbo.sample.hello.Helloworld.HelloRequest.Builder.class);
+ }
+
+ // Construct using org.apache.dubbo.sample.hello.Helloworld.HelloRequest.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ name_ = "";
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_HelloRequest_descriptor;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.HelloRequest getDefaultInstanceForType() {
+ return org.apache.dubbo.sample.hello.Helloworld.HelloRequest.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.HelloRequest build() {
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.HelloRequest buildPartial() {
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest result = new org.apache.dubbo.sample.hello.Helloworld.HelloRequest(this);
+ result.name_ = name_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.dubbo.sample.hello.Helloworld.HelloRequest) {
+ return mergeFrom((org.apache.dubbo.sample.hello.Helloworld.HelloRequest)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.dubbo.sample.hello.Helloworld.HelloRequest other) {
+ if (other == org.apache.dubbo.sample.hello.Helloworld.HelloRequest.getDefaultInstance()) return this;
+ if (!other.getName().isEmpty()) {
+ name_ = other.name_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.dubbo.sample.hello.Helloworld.HelloRequest parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.dubbo.sample.hello.Helloworld.HelloRequest) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ private java.lang.Object name_ = "";
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @param value The name to set.
+ * @return This builder for chaining.
+ */
+ public Builder setName(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return This builder for chaining.
+ */
+ public Builder clearName() {
+
+ name_ = getDefaultInstance().getName();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @param value The bytes for name to set.
+ * @return This builder for chaining.
+ */
+ public Builder setNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:helloworld.HelloRequest)
+ }
+
+ // @@protoc_insertion_point(class_scope:helloworld.HelloRequest)
+ private static final org.apache.dubbo.sample.hello.Helloworld.HelloRequest DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new org.apache.dubbo.sample.hello.Helloworld.HelloRequest();
+ }
+
+ public static org.apache.dubbo.sample.hello.Helloworld.HelloRequest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser<HelloRequest>
+ PARSER = new com.google.protobuf.AbstractParser<HelloRequest>() {
+ @java.lang.Override
+ public HelloRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new HelloRequest(input, extensionRegistry);
+ }
+ };
+
+ public static com.google.protobuf.Parser<HelloRequest> parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<HelloRequest> getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.HelloRequest getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ }
+
+ public interface UserOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:helloworld.User)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ java.lang.String getName();
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ com.google.protobuf.ByteString
+ getNameBytes();
+
+ /**
+ * <code>string id = 2;</code>
+ * @return The id.
+ */
+ java.lang.String getId();
+ /**
+ * <code>string id = 2;</code>
+ * @return The bytes for id.
+ */
+ com.google.protobuf.ByteString
+ getIdBytes();
+
+ /**
+ * <code>int32 age = 3;</code>
+ * @return The age.
+ */
+ int getAge();
+ }
+ /**
+ * <pre>
+ * The response message containing the greetings
+ * </pre>
+ *
+ * Protobuf type {@code helloworld.User}
+ */
+ public static final class User extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:helloworld.User)
+ UserOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use User.newBuilder() to construct.
+ private User(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
+ super(builder);
+ }
+ private User() {
+ name_ = "";
+ id_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new User();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private User(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ name_ = s;
+ break;
+ }
+ case 18: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ id_ = s;
+ break;
+ }
+ case 24: {
+
+ age_ = input.readInt32();
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_User_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_User_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.dubbo.sample.hello.Helloworld.User.class, org.apache.dubbo.sample.hello.Helloworld.User.Builder.class);
+ }
+
+ public static final int NAME_FIELD_NUMBER = 1;
+ private volatile java.lang.Object name_;
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ @java.lang.Override
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int ID_FIELD_NUMBER = 2;
+ private volatile java.lang.Object id_;
+ /**
+ * <code>string id = 2;</code>
+ * @return The id.
+ */
+ @java.lang.Override
+ public java.lang.String getId() {
+ java.lang.Object ref = id_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ id_ = s;
+ return s;
+ }
+ }
+ /**
+ * <code>string id = 2;</code>
+ * @return The bytes for id.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getIdBytes() {
+ java.lang.Object ref = id_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ id_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int AGE_FIELD_NUMBER = 3;
+ private int age_;
+ /**
+ * <code>int32 age = 3;</code>
+ * @return The age.
+ */
+ @java.lang.Override
+ public int getAge() {
+ return age_;
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!getNameBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
+ }
+ if (!getIdBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 2, id_);
+ }
+ if (age_ != 0) {
+ output.writeInt32(3, age_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!getNameBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
+ }
+ if (!getIdBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, id_);
+ }
+ if (age_ != 0) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(3, age_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.dubbo.sample.hello.Helloworld.User)) {
+ return super.equals(obj);
+ }
+ org.apache.dubbo.sample.hello.Helloworld.User other = (org.apache.dubbo.sample.hello.Helloworld.User) obj;
+
+ if (!getName()
+ .equals(other.getName())) return false;
+ if (!getId()
+ .equals(other.getId())) return false;
+ if (getAge()
+ != other.getAge()) return false;
+ if (!unknownFields.equals(other.unknownFields)) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + NAME_FIELD_NUMBER;
+ hash = (53 * hash) + getName().hashCode();
+ hash = (37 * hash) + ID_FIELD_NUMBER;
+ hash = (53 * hash) + getId().hashCode();
+ hash = (37 * hash) + AGE_FIELD_NUMBER;
+ hash = (53 * hash) + getAge();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.apache.dubbo.sample.hello.Helloworld.User parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(org.apache.dubbo.sample.hello.Helloworld.User prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * <pre>
+ * The response message containing the greetings
+ * </pre>
+ *
+ * Protobuf type {@code helloworld.User}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
+ // @@protoc_insertion_point(builder_implements:helloworld.User)
+ org.apache.dubbo.sample.hello.Helloworld.UserOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_User_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_User_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.dubbo.sample.hello.Helloworld.User.class, org.apache.dubbo.sample.hello.Helloworld.User.Builder.class);
+ }
+
+ // Construct using org.apache.dubbo.sample.hello.Helloworld.User.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ name_ = "";
+
+ id_ = "";
+
+ age_ = 0;
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.dubbo.sample.hello.Helloworld.internal_static_helloworld_User_descriptor;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.User getDefaultInstanceForType() {
+ return org.apache.dubbo.sample.hello.Helloworld.User.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.User build() {
+ org.apache.dubbo.sample.hello.Helloworld.User result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.User buildPartial() {
+ org.apache.dubbo.sample.hello.Helloworld.User result = new org.apache.dubbo.sample.hello.Helloworld.User(this);
+ result.name_ = name_;
+ result.id_ = id_;
+ result.age_ = age_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.dubbo.sample.hello.Helloworld.User) {
+ return mergeFrom((org.apache.dubbo.sample.hello.Helloworld.User)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.dubbo.sample.hello.Helloworld.User other) {
+ if (other == org.apache.dubbo.sample.hello.Helloworld.User.getDefaultInstance()) return this;
+ if (!other.getName().isEmpty()) {
+ name_ = other.name_;
+ onChanged();
+ }
+ if (!other.getId().isEmpty()) {
+ id_ = other.id_;
+ onChanged();
+ }
+ if (other.getAge() != 0) {
+ setAge(other.getAge());
+ }
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.apache.dubbo.sample.hello.Helloworld.User parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.apache.dubbo.sample.hello.Helloworld.User) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ private java.lang.Object name_ = "";
+ /**
+ * <code>string name = 1;</code>
+ * @return The name.
+ */
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return The bytes for name.
+ */
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @param value The name to set.
+ * @return This builder for chaining.
+ */
+ public Builder setName(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @return This builder for chaining.
+ */
+ public Builder clearName() {
+
+ name_ = getDefaultInstance().getName();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string name = 1;</code>
+ * @param value The bytes for name to set.
+ * @return This builder for chaining.
+ */
+ public Builder setNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object id_ = "";
+ /**
+ * <code>string id = 2;</code>
+ * @return The id.
+ */
+ public java.lang.String getId() {
+ java.lang.Object ref = id_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ id_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>string id = 2;</code>
+ * @return The bytes for id.
+ */
+ public com.google.protobuf.ByteString
+ getIdBytes() {
+ java.lang.Object ref = id_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ id_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>string id = 2;</code>
+ * @param value The id to set.
+ * @return This builder for chaining.
+ */
+ public Builder setId(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ id_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string id = 2;</code>
+ * @return This builder for chaining.
+ */
+ public Builder clearId() {
+
+ id_ = getDefaultInstance().getId();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>string id = 2;</code>
+ * @param value The bytes for id to set.
+ * @return This builder for chaining.
+ */
+ public Builder setIdBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ id_ = value;
+ onChanged();
+ return this;
+ }
+
+ private int age_ ;
+ /**
+ * <code>int32 age = 3;</code>
+ * @return The age.
+ */
+ @java.lang.Override
+ public int getAge() {
+ return age_;
+ }
+ /**
+ * <code>int32 age = 3;</code>
+ * @param value The age to set.
+ * @return This builder for chaining.
+ */
+ public Builder setAge(int value) {
+
+ age_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>int32 age = 3;</code>
+ * @return This builder for chaining.
+ */
+ public Builder clearAge() {
+
+ age_ = 0;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:helloworld.User)
+ }
+
+ // @@protoc_insertion_point(class_scope:helloworld.User)
+ private static final org.apache.dubbo.sample.hello.Helloworld.User DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new org.apache.dubbo.sample.hello.Helloworld.User();
+ }
+
+ public static org.apache.dubbo.sample.hello.Helloworld.User getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser<User>
+ PARSER = new com.google.protobuf.AbstractParser<User>() {
+ @java.lang.Override
+ public User parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new User(input, extensionRegistry);
+ }
+ };
+
+ public static com.google.protobuf.Parser<User> parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<User> getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public org.apache.dubbo.sample.hello.Helloworld.User getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ }
+
+ private static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_helloworld_HelloRequest_descriptor;
+ private static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_helloworld_HelloRequest_fieldAccessorTable;
+ private static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_helloworld_User_descriptor;
+ private static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_helloworld_User_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\020helloworld.proto\022\nhelloworld\"\034\n\014HelloR" +
+ "equest\022\014\n\004name\030\001 \001(\t\"-\n\004User\022\014\n\004name\030\001 \001" +
+ "(\t\022\n\n\002id\030\002 \001(\t\022\013\n\003age\030\003 \001(\005B\037\n\035org.apach" +
+ "e.dubbo.sample.hellob\006proto3"
+ };
+ descriptor = com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ });
+ internal_static_helloworld_HelloRequest_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_helloworld_HelloRequest_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_helloworld_HelloRequest_descriptor,
+ new java.lang.String[] { "Name", });
+ internal_static_helloworld_User_descriptor =
+ getDescriptor().getMessageTypes().get(1);
+ internal_static_helloworld_User_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_helloworld_User_descriptor,
+ new java.lang.String[] { "Name", "Id", "Age", });
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/helloworld/java-server/pom.xml b/helloworld/java-server/pom.xml
index e299ade..dd518ca 100644
--- a/helloworld/java-server/pom.xml
+++ b/helloworld/java-server/pom.xml
@@ -1,188 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <groupId>org.apache.dubbo</groupId>
+ <version>1.0-SNAPSHOT</version>
+
<modelVersion>4.0.0</modelVersion>
- <groupId>com.ikurento</groupId>
- <artifactId>user-info-server</artifactId>
- <packaging>jar</packaging>
- <version>0.2.0</version>
- <description>The demo provider module of dubbo project</description>
- <properties>
- <skip_maven_deploy>false</skip_maven_deploy>
+ <artifactId>dubbo-samples-triple</artifactId>
- <dubbo-version>2.6.5</dubbo-version>
- <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <properties>
+ <source.level>1.8</source.level>
+ <target.level>1.8</target.level>
+ <dubbo.version>3.0.0</dubbo.version>
+ <junit.version>4.12</junit.version>
+ <spring-test.version>4.3.16.RELEASE</spring-test.version>
+ <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+ <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
+ <spring-boot.version>1.5.13.RELEASE</spring-boot.version>
+ <grpc.version>1.19.0</grpc.version>
+ <protoc.version>3.7.1</protoc.version>
</properties>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo-dependencies-bom</artifactId>
- <version>${dubbo-version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<dependencies>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.25</version>
- </dependency>
-
- <dependency>
- <groupId>com.alibaba</groupId>
+ <groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- <exclusions>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
+ <version>${dubbo.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>2.12.0</version>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>3.14.0</version>
</dependency>
-
<dependency>
- <groupId>com.qianmi</groupId>
- <artifactId>dubbo-rpc-jsonrpc</artifactId>
- <version>${dubbo-jsonrpc-version}</version>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
<exclusions>
<exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
</exclusion>
</exclusions>
</dependency>
-
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.26</version>
- </dependency>
-
<dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.10.0</version>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ <version>3.4.8</version>
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.10.0</version>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
</dependency>
-
<dependency>
- <groupId>com.github.sgroschupf</groupId>
- <artifactId>zkclient</artifactId>
- <version>0.1</version>
- <exclusions>
- <exclusion>
- <artifactId>org.apache.zookeeper</artifactId>
- <groupId>zookeeper</groupId>
- </exclusion>
- </exclusions>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring-test.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.4.14</version>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>testcontainers</artifactId>
+ <version>1.12.3</version>
+ <scope>test</scope>
</dependency>
-
</dependencies>
- <repositories>
- <repository>
- <id>nexus-aliyu</id>
- <url>https://maven.aliyun.com/nexus/content/groups/public</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>nexus-aliyu</id>
- <url>https://maven.aliyun.com/nexus/content/groups/public</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
-
+ <profiles>
+ <!-- For jdk 11 above JavaEE annotation -->
+ <profile>
+ <id>javax.annotation</id>
+ <activation>
+ <jdk>[1.11,)</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
<build>
+ <defaultGoal>package</defaultGoal>
+ <extensions>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ <version>1.6.1</version>
+ </extension>
+ </extensions>
<plugins>
<plugin>
- <artifactId>maven-dependency-plugin</artifactId>
+ <groupId>org.xolstice.maven.plugins</groupId>
+ <artifactId>protobuf-maven-plugin</artifactId>
+ <version>0.6.1</version>
+ <configuration>
+ <protocArtifact>com.google.protobuf:protoc:3.17.3:exe:${os.detected.classifier}</protocArtifact>
+ <pluginId>triple-java</pluginId>
+ <outputDirectory>build/generated/source/proto/main/java</outputDirectory>
+ </configuration>
<executions>
<execution>
- <id>unpack</id>
- <phase>package</phase>
<goals>
- <goal>unpack</goal>
+ <goal>compile</goal>
+ <goal>test-compile</goal>
</goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- <outputDirectory>${project.build.directory}/dubbo</outputDirectory>
- <includes>META-INF/assembly/**</includes>
- </artifactItem>
- </artifactItems>
- </configuration>
</execution>
</executions>
</plugin>
-
<plugin>
- <artifactId>maven-assembly-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <configuration>
+ <source>${source.level}</source>
+ <target>${target.level}</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
- <id>make-assembly</id>
- <phase>package</phase>
+ <phase>generate-sources</phase>
<goals>
- <goal>single</goal>
+ <goal>add-source</goal>
</goals>
<configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
+ <sources>
+ <source>build/generated/source/proto/main/java</source>
+ </sources>
</configuration>
</execution>
</executions>
@@ -190,7 +163,4 @@
</plugins>
</build>
-
-</project>
-
-
+</project>
\ No newline at end of file
diff --git a/helloworld/java-server/run.sh b/helloworld/java-server/run.sh
new file mode 100644
index 0000000..939b13d
--- /dev/null
+++ b/helloworld/java-server/run.sh
@@ -0,0 +1,2 @@
+mvn install -DSkipTests
+mvn exec:java -Dexec.mainClass="com.apache.dubbo.sample.basic.ApiProvider"
\ No newline at end of file
diff --git a/helloworld/java-server/script/debug.sh b/helloworld/java-server/script/debug.sh
deleted file mode 100644
index 851957a..0000000
--- a/helloworld/java-server/script/debug.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# jdb -classpath /Users/alex/tmp/us/conf:/Users/alex/tmp/us/lib/*:/Users/alex/test/java/dubbo/2.5.4/dubbo-remoting/dubbo-remoting-api/src/main/java/ com.alibaba.dubbo.container.Main
-jdb -classpath /Users/alex/tmp/us/conf:/Users/alex/tmp/us/lib/* -sourcepath /Users/alex/test/java/dubbo/2.5.4/dubbo-remoting/dubbo-remoting-api/src/main/java/:/Users/alex/tmp/java-server/src/main/java com.alibaba.dubbo.container.Main
-# jdb stop at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec:76
-# run
-
diff --git a/helloworld/java-server/src/main/assembly/assembly.xml b/helloworld/java-server/src/main/assembly/assembly.xml
deleted file mode 100644
index 60df0c5..0000000
--- a/helloworld/java-server/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<assembly>
- <id>assembly</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${project.build.directory}/dubbo/META-INF/assembly/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <fileMode>0755</fileMode>
- <directoryMode>0755</directoryMode>
- </fileSet>
- <fileSet>
- <directory>src/main/resources</directory>
- <includes>
- <include>dubbo.properties</include>
- <include>log4j.*</include>
- </includes>
- <outputDirectory>conf</outputDirectory>
- <fileMode>0644</fileMode>
- <directoryMode>0755</directoryMode>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- </dependencySet>
- </dependencySets>
-</assembly>
\ No newline at end of file
diff --git a/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java b/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java
new file mode 100644
index 0000000..e052dcb
--- /dev/null
+++ b/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.apache.dubbo.sample.basic;
+
+import org.apache.dubbo.common.constants.CommonConstants;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.ServiceConfig;
+import java.util.concurrent.CountDownLatch;
+
+public class ApiProvider {
+ public static void main(String[] args) throws InterruptedException {
+ ServiceConfig<IGreeter> service = new ServiceConfig<>();
+ service.setInterface(IGreeter.class);
+ service.setRef(new IGreeter1Impl());
+ service.setProtocol(new ProtocolConfig(CommonConstants.TRIPLE, 50051));
+ service.setApplication(new ApplicationConfig("demo-provider"));
+ service.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
+ service.export();
+ System.out.println("dubbo service started");
+ new CountDownLatch(1).await();
+ }
+}
diff --git a/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/IGreeter.java b/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/IGreeter.java
new file mode 100644
index 0000000..e8aa2fe
--- /dev/null
+++ b/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/IGreeter.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.apache.dubbo.sample.basic;
+
+import org.apache.dubbo.sample.hello.Helloworld;
+
+public interface IGreeter {
+ /**
+ * <pre>
+ * Sends a greeting
+ * </pre>
+ */
+ Helloworld.User sayHello(Helloworld.HelloRequest request);
+
+}
diff --git a/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/IGreeter1Impl.java b/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/IGreeter1Impl.java
new file mode 100644
index 0000000..dfb1ac8
--- /dev/null
+++ b/helloworld/java-server/src/main/java/com/apache/dubbo/sample/basic/IGreeter1Impl.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.apache.dubbo.sample.basic;
+
+
+import org.apache.dubbo.sample.hello.Helloworld.User;
+import org.apache.dubbo.sample.hello.Helloworld.HelloRequest;
+
+public class IGreeter1Impl implements IGreeter {
+ @Override
+ public User sayHello(HelloRequest request) {
+ System.out.println("receiv: " + request);
+ User usr = User.newBuilder()
+ .setName("hello " + request.getName())
+ .setAge(18)
+ .setId("12345").build();
+ return usr;
+ }
+}
diff --git a/helloworld/java-server/src/main/java/org/apache/dubbo/Provider.java b/helloworld/java-server/src/main/java/org/apache/dubbo/Provider.java
deleted file mode 100644
index a50220a..0000000
--- a/helloworld/java-server/src/main/java/org/apache/dubbo/Provider.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class Provider {
-
- /**
- * To get ipv6 address to work, add
- * System.setProperty("java.net.preferIPv6Addresses", "true");
- * before running your application.
- */
- public static void main(String[] args) throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo.provider.xml"});
- context.start();
- System.in.read(); // press any key to exit
- }
-}
diff --git a/helloworld/java-server/src/main/java/org/apache/dubbo/User.java b/helloworld/java-server/src/main/java/org/apache/dubbo/User.java
deleted file mode 100644
index 8483880..0000000
--- a/helloworld/java-server/src/main/java/org/apache/dubbo/User.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dubbo;
-
-import java.util.Date;
-import java.io.Serializable;
-
-public class User implements Serializable {
-
- private String id;
-
- private String name;
-
- private int age;
-
- private Date time = new Date();
-
- public User() {
- }
-
- public User(String id, String name, int age) {
- this.id = id;
- this.name = name;
- this.age = age;
- }
-
- public User(String id, String name, int age, Date time) {
- this.id = id;
- this.name = name;
- this.age = age;
- this.time = time;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public Date getTime() {
- return time;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
-
-
- public String toString() {
- return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time +"}";
- }
-}
diff --git a/helloworld/java-server/src/main/java/org/apache/dubbo/UserProvider.java b/helloworld/java-server/src/main/java/org/apache/dubbo/UserProvider.java
deleted file mode 100644
index d07a757..0000000
--- a/helloworld/java-server/src/main/java/org/apache/dubbo/UserProvider.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dubbo;
-
-public interface UserProvider {
-
- User GetUser(String userId); // the first alpha is Upper case to compatible with golang.
-
-}
diff --git a/helloworld/java-server/src/main/java/org/apache/dubbo/UserProviderImpl.java b/helloworld/java-server/src/main/java/org/apache/dubbo/UserProviderImpl.java
deleted file mode 100644
index 74a6c09..0000000
--- a/helloworld/java-server/src/main/java/org/apache/dubbo/UserProviderImpl.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dubbo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProviderImpl implements UserProvider {
- private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); //Output to user-server.log
-
- public User GetUser(String userId) {
- return new User(userId, "zhangsan", 18);
- }
-
-}
diff --git a/helloworld/java-server/src/main/proto/helloworld.proto b/helloworld/java-server/src/main/proto/helloworld.proto
new file mode 100644
index 0000000..ee6ca29
--- /dev/null
+++ b/helloworld/java-server/src/main/proto/helloworld.proto
@@ -0,0 +1,28 @@
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+syntax = "proto3";
+
+option java_package = "org.apache.dubbo.sample.hello";
+
+package helloworld;
+
+// The request message containing the user's name.
+message HelloRequest {
+ string name = 1;
+}
+
+// The response message containing the greetings
+message User {
+ string name = 1;
+ string id = 2;
+ int32 age = 3;
+}
diff --git a/helloworld/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml b/helloworld/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
deleted file mode 100644
index 2d01d66..0000000
--- a/helloworld/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
- <!-- 应用名 -->
- <dubbo:application name="user-info-server"/>
- <!-- 连接到哪个本地注册中心 -->
- <dubbo:registry id="demoZk" address="zookeeper://127.0.0.1:2181"/>
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <!-- dubbo:protocol host="127.0.0.1" / -->
- <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" port="20010"/>
- <!-- 声明需要暴露的服务接口 -->
- <dubbo:service id="aaa" registry="demoZk" timeout="3000" interface="org.apache.dubbo.UserProvider"
- ref="demoService"/>
-
- <bean id="demoService" class="org.apache.dubbo.UserProviderImpl"/>
-
-</beans>
diff --git a/helloworld/java-server/src/main/resources/dubbo.properties b/helloworld/java-server/src/main/resources/dubbo.properties
deleted file mode 100644
index 37df62e..0000000
--- a/helloworld/java-server/src/main/resources/dubbo.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-### dubbo注册中心配置 ##
-dubbo.container=log4j,spring
-dubbo.application.name=user-info-server
-dubbo.application.environment=product
-dubbo.application.owner=AlexStocks
-dubbo.registry.address=127.0.0.1:2181
-dubbo.registry.protocol=zookeeper
-dubbo.consumer.timeout=10000
-dubbo.provider.timeout=10000
-dubbo.protocol.name=dubbo
-dubbo.protocol.port=10000
-dubbo.log4j.file=logs/dubbo.log
-dubbo.log4j.level=INFO
diff --git a/helloworld/java-server/src/main/resources/log4j.properties b/helloworld/java-server/src/main/resources/log4j.properties
index e2d0517..6b82aba 100644
--- a/helloworld/java-server/src/main/resources/log4j.properties
+++ b/helloworld/java-server/src/main/resources/log4j.properties
@@ -1,17 +1,26 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-log4j.rootLogger=DEBUG, file, console
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+###set log levels###
+log4j.rootLogger=debug, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/helloworld/protobuf/helloworld.pb.go b/helloworld/protobuf/helloworld.pb.go
new file mode 100644
index 0000000..89625a4
--- /dev/null
+++ b/helloworld/protobuf/helloworld.pb.go
@@ -0,0 +1,323 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: helloworld.proto
+
+package protobuf
+
+import (
+ context "context"
+ fmt "fmt"
+ math "math"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/protocol"
+ dgrpc "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
+ "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
+
+ tripleConstant "github.com/dubbogo/triple/pkg/common/constant"
+ dubbo3 "github.com/dubbogo/triple/pkg/triple"
+
+ proto "github.com/golang/protobuf/proto"
+
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+
+ status "google.golang.org/grpc/status"
+)
+
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+
+// The request message containing the user's name.
+type HelloRequest struct {
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *HelloRequest) Reset() { *m = HelloRequest{} }
+func (m *HelloRequest) String() string { return proto.CompactTextString(m) }
+func (*HelloRequest) ProtoMessage() {}
+func (*HelloRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_17b8c58d586b62f2, []int{0}
+}
+
+func (m *HelloRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_HelloRequest.Unmarshal(m, b)
+}
+func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_HelloRequest.Marshal(b, m, deterministic)
+}
+func (m *HelloRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_HelloRequest.Merge(m, src)
+}
+func (m *HelloRequest) XXX_Size() int {
+ return xxx_messageInfo_HelloRequest.Size(m)
+}
+func (m *HelloRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_HelloRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_HelloRequest proto.InternalMessageInfo
+
+func (m *HelloRequest) GetName() string {
+ if m != nil {
+ return m.Name
+ }
+ return ""
+}
+
+// The response message containing the greetings
+type User struct {
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
+ Age int32 `protobuf:"varint,3,opt,name=age,proto3" json:"age,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *User) Reset() { *m = User{} }
+func (m *User) String() string { return proto.CompactTextString(m) }
+func (*User) ProtoMessage() {}
+func (*User) Descriptor() ([]byte, []int) {
+ return fileDescriptor_17b8c58d586b62f2, []int{1}
+}
+
+func (m *User) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_User.Unmarshal(m, b)
+}
+func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_User.Marshal(b, m, deterministic)
+}
+func (m *User) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_User.Merge(m, src)
+}
+func (m *User) XXX_Size() int {
+ return xxx_messageInfo_User.Size(m)
+}
+func (m *User) XXX_DiscardUnknown() {
+ xxx_messageInfo_User.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_User proto.InternalMessageInfo
+
+func (m *User) GetName() string {
+ if m != nil {
+ return m.Name
+ }
+ return ""
+}
+
+func (m *User) GetId() string {
+ if m != nil {
+ return m.Id
+ }
+ return ""
+}
+
+func (m *User) GetAge() int32 {
+ if m != nil {
+ return m.Age
+ }
+ return 0
+}
+
+func init() {
+ proto.RegisterType((*HelloRequest)(nil), "protobuf.HelloRequest")
+ proto.RegisterType((*User)(nil), "protobuf.User")
+}
+
+func init() { proto.RegisterFile("helloworld.proto", fileDescriptor_17b8c58d586b62f2) }
+
+var fileDescriptor_17b8c58d586b62f2 = []byte{
+ // 160 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x48, 0xcd, 0xc9,
+ 0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x00, 0x53,
+ 0x49, 0xa5, 0x69, 0x4a, 0x4a, 0x5c, 0x3c, 0x1e, 0x20, 0xd9, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2,
+ 0x12, 0x21, 0x21, 0x2e, 0x96, 0xbc, 0xc4, 0xdc, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20,
+ 0x30, 0x5b, 0xc9, 0x86, 0x8b, 0x25, 0xb4, 0x38, 0xb5, 0x08, 0x9b, 0x9c, 0x10, 0x1f, 0x17, 0x53,
+ 0x66, 0x8a, 0x04, 0x13, 0x58, 0x84, 0x29, 0x33, 0x45, 0x48, 0x80, 0x8b, 0x39, 0x31, 0x3d, 0x55,
+ 0x82, 0x59, 0x81, 0x51, 0x83, 0x35, 0x08, 0xc4, 0x34, 0xb2, 0xe7, 0x62, 0x77, 0x2f, 0x4a, 0x4d,
+ 0x2d, 0x49, 0x2d, 0x12, 0x32, 0xe1, 0xe2, 0x08, 0x4e, 0xac, 0x04, 0xdb, 0x27, 0x24, 0xa6, 0x07,
+ 0x73, 0x83, 0x1e, 0xb2, 0x03, 0xa4, 0xf8, 0x10, 0xe2, 0x20, 0x4b, 0x95, 0x18, 0x92, 0xd8, 0xc0,
+ 0x02, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcf, 0xdb, 0xd1, 0x8b, 0xc7, 0x00, 0x00, 0x00,
+}
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ context.Context
+var _ grpc.ClientConnInterface
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+const _ = grpc.SupportPackageIsVersion6
+
+// GreeterClient is the client API for Greeter service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
+type GreeterClient interface {
+ // Sends a greeting
+ SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*User, error)
+}
+
+type greeterClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient {
+ return &greeterClient{cc}
+}
+
+func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*User, error) {
+ out := new(User)
+ err := c.cc.Invoke(ctx, "/protobuf.Greeter/SayHello", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// GreeterServer is the server API for Greeter service.
+type GreeterServer interface {
+ // Sends a greeting
+ SayHello(context.Context, *HelloRequest) (*User, error)
+}
+
+// UnimplementedGreeterServer can be embedded to have forward compatible implementations.
+type UnimplementedGreeterServer struct {
+}
+
+func (*UnimplementedGreeterServer) SayHello(ctx context.Context, req *HelloRequest) (*User, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
+}
+
+func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
+ s.RegisterService(&_Greeter_serviceDesc, srv)
+}
+
+func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(HelloRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(GreeterServer).SayHello(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/protobuf.Greeter/SayHello",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+var _Greeter_serviceDesc = grpc.ServiceDesc{
+ ServiceName: "protobuf.Greeter",
+ HandlerType: (*GreeterServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "SayHello",
+ Handler: _Greeter_SayHello_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "helloworld.proto",
+}
+
+type greeterDubbo3Client struct {
+ cc *dubbo3.TripleConn
+}
+
+func NewGreeterDubbo3Client(cc *dubbo3.TripleConn) GreeterClient {
+ return &greeterDubbo3Client{cc}
+}
+func (c *greeterDubbo3Client) SayHello(ctx context.Context, in *HelloRequest, opt ...grpc.CallOption) (*User, error) {
+ out := new(User)
+ interfaceKey := ctx.Value(tripleConstant.InterfaceKey).(string)
+ err := c.cc.Invoke(ctx, "/"+interfaceKey+"/SayHello", in, out)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// GreeterClientImpl is the client API for Greeter service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
+type GreeterClientImpl struct {
+ // Sends a greeting
+ SayHello func(ctx context.Context, in *HelloRequest, out *User) error
+}
+
+func (c *GreeterClientImpl) Reference() string {
+ return "greeterImpl"
+}
+
+func (c *GreeterClientImpl) GetDubboStub(cc *dubbo3.TripleConn) GreeterClient {
+ return NewGreeterDubbo3Client(cc)
+}
+
+type GreeterProviderBase struct {
+ proxyImpl protocol.Invoker
+}
+
+func (s *GreeterProviderBase) SetProxyImpl(impl protocol.Invoker) {
+ s.proxyImpl = impl
+}
+
+func (s *GreeterProviderBase) GetProxyImpl() protocol.Invoker {
+ return s.proxyImpl
+}
+
+func (c *GreeterProviderBase) Reference() string {
+ return "greeterImpl"
+}
+
+func _DUBBO_Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(HelloRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ base := srv.(dgrpc.Dubbo3GrpcService)
+ args := []interface{}{}
+ args = append(args, in)
+ invo := invocation.NewRPCInvocation("SayHello", args, nil)
+ if interceptor == nil {
+ result := base.GetProxyImpl().Invoke(ctx, invo)
+ return result.Result(), result.Error()
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/protobuf.Greeter/SayHello",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ result := base.GetProxyImpl().Invoke(context.Background(), invo)
+ return result.Result(), result.Error()
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func (s *GreeterProviderBase) ServiceDesc() *grpc.ServiceDesc {
+ return &grpc.ServiceDesc{
+ ServiceName: "protobuf.Greeter",
+ HandlerType: (*GreeterServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "SayHello",
+ Handler: _DUBBO_Greeter_SayHello_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "helloworld.proto",
+ }
+}
diff --git a/helloworld/go-client/pkg/user.go b/helloworld/protobuf/helloworld.proto
similarity index 68%
rename from helloworld/go-client/pkg/user.go
rename to helloworld/protobuf/helloworld.proto
index 7733ea4..92b2876 100644
--- a/helloworld/go-client/pkg/user.go
+++ b/helloworld/protobuf/helloworld.proto
@@ -15,28 +15,23 @@
* limitations under the License.
*/
-package pkg
+syntax = "proto3";
+package protobuf;
-import (
- "context"
- "time"
-)
-
-type User struct {
- ID string
- Name string
- Age int32
- Time time.Time
-}
-
-type UserProvider struct {
- GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+// The greeting service definition.
+service Greeter {
+ // Sends a greeting
+ rpc SayHello (HelloRequest) returns (User) {}
}
-func (u *UserProvider) Reference() string {
- return "UserProvider"
+// The request message containing the user's name.
+message HelloRequest {
+ string name = 1;
}
-func (User) JavaClassName() string {
- return "org.apache.dubbo.User"
-}
+// The response message containing the greetings
+message User {
+ string name = 1;
+ string id = 2;
+ int32 age = 3;
+}
\ No newline at end of file
diff --git a/helloworld/protobuf/protobuf.mk b/helloworld/protobuf/protobuf.mk
new file mode 100644
index 0000000..5680c3d
--- /dev/null
+++ b/helloworld/protobuf/protobuf.mk
@@ -0,0 +1,26 @@
+.PHONY: compile
+PROTOC_GEN_GO := $(GOPATH)/bin/protoc-gen-go
+PROTOC := $(shell which protoc)
+ifeq ($(PROTOC),)
+ PROTOC = must-rebuild
+endif
+
+UNAME := $(shell uname)
+
+$(PROTOC):
+ifeq ($(UNAME), Darwin)
+ brew install protobuf
+endif
+ifeq ($(UNAME), Linux)
+ sudo apt-get install protobuf-compiler
+endif
+
+$(PROTOC_GEN_GO):
+ go get -u dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/protoc-gen-dubbo3
+
+helloworld.pb.go: helloworld.proto | $(PROTOC_GEN_GO) $(PROTOC)
+ protoc -I . helloworld.proto --dubbo3_out=plugins=grpc+dubbo:.
+
+.PHONY: compile
+compile: helloworld.pb.go
+
diff --git a/logger/go-client/cmd/client.go b/logger/go-client/cmd/client.go
index b1815bf..7b7841a 100755
--- a/logger/go-client/cmd/client.go
+++ b/logger/go-client/cmd/client.go
@@ -38,7 +38,7 @@ import (
)
import (
- "github.com/apache/dubbo-go-samples/helloworld/go-client/pkg"
+ "github.com/apache/dubbo-go-samples/logger/go-client/pkg"
)
var userProvider = new(pkg.UserProvider)