AlexStocks commented on a change in pull request #52:
URL: https://github.com/apache/dubbo-go-samples/pull/52#discussion_r587585406
##########
File path: helloworld/README.md
##########
@@ -0,0 +1,135 @@
+## 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
Review comment:
Id -> ID
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]