You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by la...@apache.org on 2021/09/08 04:50:38 UTC

[dubbo-go-samples] branch config-enhance updated: Ftr: dubbo context sample (#229)

This is an automated email from the ASF dual-hosted git repository.

laurence pushed a commit to branch config-enhance
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git


The following commit(s) were added to refs/heads/config-enhance by this push:
     new 5f713d8  Ftr: dubbo context sample (#229)
5f713d8 is described below

commit 5f713d81b2dacf9a7b4e0e196f7dd929a715e2e6
Author: 氕氘氚 <cj...@163.com>
AuthorDate: Wed Sep 8 12:50:31 2021 +0800

    Ftr: dubbo context sample (#229)
    
    * add dubbbo-context
    
    * add dubbo-context sample
    
    * fix: undo delete xml
    
    * fix: replace []interface to struct & delete "
    
    Co-authored-by: cachen <ca...@tencent.com>
---
 .run/context-client.run.xml                        | 15 -----
 .run/context-dubbo-client.run.xml                  | 15 +++++
 .run/context-dubbo-server.run.xml                  | 15 +++++
 .run/context-server.run.xml                        | 15 -----
 .run/context-triple-client.run.xml                 | 24 +++----
 .run/context-triple-server.run.xml                 | 24 +++----
 .run/registry/registry-nacos-go-client.run.xml     | 26 ++++----
 .run/registry/registry-nacos-go-server.run.xml     | 28 ++++----
 context/dubbo/go-client/cmd/client.go              | 49 +++++++-------
 context/dubbo/go-client/conf/client.yml            | 59 ----------------
 context/dubbo/go-client/conf/dubbogo.yml           | 37 ++++++++++
 context/dubbo/go-client/conf/log.yml               | 27 --------
 context/dubbo/go-client/pkg/user.go                | 45 -------------
 context/dubbo/go-server/cmd/server.go              | 63 +++++++++++++----
 context/dubbo/go-server/conf/client.yml            | 59 ----------------
 context/dubbo/go-server/conf/dubbogo.yml           | 33 +++++++++
 context/dubbo/go-server/conf/log.yml               | 27 --------
 context/dubbo/go-server/conf/server.yml            | 55 ---------------
 context/dubbo/go-server/docker/docker-compose.yml  |  9 ---
 .../dubbo/go-server/docker/docker-health-check.sh  | 10 ---
 context/dubbo/go-server/pkg/user.go                | 78 ----------------------
 .../dubbo/go-server/tests/integration/main_test.go | 75 ---------------------
 .../tests/integration/userprovider_test.go         | 58 ----------------
 context/triple/go-client/cmd/client.go             |  4 +-
 start_integrate_test.sh                            |  2 +-
 25 files changed, 231 insertions(+), 621 deletions(-)

diff --git a/.run/context-client.run.xml b/.run/context-client.run.xml
deleted file mode 100644
index d801885..0000000
--- a/.run/context-client.run.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="context-client" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="v3config-context" singleton="false">
-    <module name="dubbo-go-samples" />
-    <working_directory value="$PROJECT_DIR$" />
-    <envs>
-      <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/context/go-client/conf/log.yml" />
-      <env name="CONF_CONSUMER_FILE_PATH" value="$PROJECT_DIR$/context/go-client/conf/client.yml" />
-    </envs>
-    <kind value="PACKAGE" />
-    <package value="github.com/apache/dubbo-go-samples/context/go-client/cmd" />
-    <directory value="$PROJECT_DIR$" />
-    <filePath value="$PROJECT_DIR$/context/go-client/cmd/client.go" />
-    <method v="2" />
-  </configuration>
-</component>
\ No newline at end of file
diff --git a/.run/context-dubbo-client.run.xml b/.run/context-dubbo-client.run.xml
new file mode 100644
index 0000000..773db5b
--- /dev/null
+++ b/.run/context-dubbo-client.run.xml
@@ -0,0 +1,15 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="context-dubbo-client" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="v3config-context" singleton="false">
+    <module name="dubbo-go-samples" />
+    <working_directory value="$PROJECT_DIR$" />
+    <envs>
+      <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/context/dubbo/go-client/conf/log.yml" />
+      <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/context/dubbo/go-client/conf/dubbogo.yml" />
+    </envs>
+    <kind value="PACKAGE" />
+    <package value="github.com/apache/dubbo-go-samples/context/dubbo/go-client/cmd" />
+    <directory value="$PROJECT_DIR$" />
+    <filePath value="$PROJECT_DIR$/context/go-client/dubbo/cmd/client.go" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.run/context-dubbo-server.run.xml b/.run/context-dubbo-server.run.xml
new file mode 100644
index 0000000..4a879ca
--- /dev/null
+++ b/.run/context-dubbo-server.run.xml
@@ -0,0 +1,15 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="context-dubbo-server" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="v3config-context" singleton="false">
+    <module name="dubbo-go-samples" />
+    <working_directory value="$PROJECT_DIR$" />
+    <envs>
+      <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/context/dubbo/go-server/conf/dubbogo.yml" />
+      <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/context/dubbo/go-server/conf/log.yml" />
+    </envs>
+    <kind value="PACKAGE" />
+    <package value="github.com/apache/dubbo-go-samples/context/dubbo/go-server/cmd" />
+    <directory value="$PROJECT_DIR$" />
+    <filePath value="$PROJECT_DIR$/context/dubbo/go-server/cmd/server.go" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.run/context-server.run.xml b/.run/context-server.run.xml
deleted file mode 100644
index cacd6bd..0000000
--- a/.run/context-server.run.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="context-server" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="v3config-context" singleton="false">
-    <module name="dubbo-go-samples" />
-    <working_directory value="$PROJECT_DIR$" />
-    <envs>
-      <env name="CONF_PROVIDER_FILE_PATH" value="$PROJECT_DIR$/context/go-server/conf/server.yml" />
-      <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/context/go-server/conf/log.yml" />
-    </envs>
-    <kind value="PACKAGE" />
-    <package value="github.com/apache/dubbo-go-samples/context/go-server/cmd" />
-    <directory value="$PROJECT_DIR$" />
-    <filePath value="$PROJECT_DIR$/context/go-server/cmd/server.go" />
-    <method v="2" />
-  </configuration>
-</component>
\ No newline at end of file
diff --git a/.run/context-triple-client.run.xml b/.run/context-triple-client.run.xml
index eb36e49..b810a6b 100644
--- a/.run/context-triple-client.run.xml
+++ b/.run/context-triple-client.run.xml
@@ -1,14 +1,14 @@
 <component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="context-triple-client" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="v3config-context">
-    <module name="dubbo-go-samples" />
-    <working_directory value="$PROJECT_DIR$" />
-    <envs>
-      <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/context/triple/go-client/conf/dubbogo.yml" />
-    </envs>
-    <kind value="PACKAGE" />
-    <package value="github.com/apache/dubbo-go-samples/context/triple/go-client/cmd" />
-    <directory value="$PROJECT_DIR$" />
-    <filePath value="$PROJECT_DIR$/helloworld/go-client/cmd/client.go" />
-    <method v="2" />
-  </configuration>
+    <configuration default="false" name="context-triple-client" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="v3config-context">
+        <module name="dubbo-go-samples" />
+        <working_directory value="$PROJECT_DIR$" />
+        <envs>
+            <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/context/triple/go-client/conf/dubbogo.yml" />
+        </envs>
+        <kind value="PACKAGE" />
+        <package value="github.com/apache/dubbo-go-samples/context/triple/go-client/cmd" />
+        <directory value="$PROJECT_DIR$" />
+        <filePath value="$PROJECT_DIR$/helloworld/go-client/cmd/client.go" />
+        <method v="2" />
+    </configuration>
 </component>
\ No newline at end of file
diff --git a/.run/context-triple-server.run.xml b/.run/context-triple-server.run.xml
index d1f9188..460e176 100644
--- a/.run/context-triple-server.run.xml
+++ b/.run/context-triple-server.run.xml
@@ -1,14 +1,14 @@
 <component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="context-triple-server" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="v3config-context">
-    <module name="dubbo-go-samples" />
-    <working_directory value="$PROJECT_DIR$" />
-    <envs>
-      <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/context/triple/go-server/conf/dubbogo.yml" />
-    </envs>
-    <kind value="PACKAGE" />
-    <package value="github.com/apache/dubbo-go-samples/context/triple/go-server/cmd" />
-    <directory value="$PROJECT_DIR$" />
-    <filePath value="$PROJECT_DIR$/helloworld/go-client/cmd/client.go" />
-    <method v="2" />
-  </configuration>
+    <configuration default="false" name="context-triple-server" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="v3config-context">
+        <module name="dubbo-go-samples" />
+        <working_directory value="$PROJECT_DIR$" />
+        <envs>
+            <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/context/triple/go-server/conf/dubbogo.yml" />
+        </envs>
+        <kind value="PACKAGE" />
+        <package value="github.com/apache/dubbo-go-samples/context/triple/go-server/cmd" />
+        <directory value="$PROJECT_DIR$" />
+        <filePath value="$PROJECT_DIR$/helloworld/go-client/cmd/client.go" />
+        <method v="2" />
+    </configuration>
 </component>
\ No newline at end of file
diff --git a/.run/registry/registry-nacos-go-client.run.xml b/.run/registry/registry-nacos-go-client.run.xml
index 0f9987d..a5222da 100644
--- a/.run/registry/registry-nacos-go-client.run.xml
+++ b/.run/registry/registry-nacos-go-client.run.xml
@@ -1,15 +1,15 @@
 <component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="registry-nacos-go-client" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="registry">
-    <module name="dubbo-go-samples" />
-    <working_directory value="$PROJECT_DIR$" />
-    <envs>
-      <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/registry/nacos/go-client/conf/dubbogo.yml" />
-      <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/registry/nacos/go-client/conf/log.yml" />
-    </envs>
-    <kind value="PACKAGE" />
-    <package value="github.com/apache/dubbo-go-samples/registry/nacos/go-client/cmd" />
-    <directory value="$PROJECT_DIR$" />
-    <filePath value="$PROJECT_DIR$/general/grpc/unary/go-client/cmd/client.go" />
-    <method v="2" />
-  </configuration>
+    <configuration default="false" name="registry-nacos-go-client" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="registry">
+        <module name="dubbo-go-samples" />
+        <working_directory value="$PROJECT_DIR$" />
+        <envs>
+            <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/registry/nacos/go-client/conf/dubbogo.yml" />
+            <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/registry/nacos/go-client/conf/log.yml" />
+        </envs>
+        <kind value="PACKAGE" />
+        <package value="github.com/apache/dubbo-go-samples/registry/nacos/go-client/cmd" />
+        <directory value="$PROJECT_DIR$" />
+        <filePath value="$PROJECT_DIR$/general/grpc/unary/go-client/cmd/client.go" />
+        <method v="2" />
+    </configuration>
 </component>
\ No newline at end of file
diff --git a/.run/registry/registry-nacos-go-server.run.xml b/.run/registry/registry-nacos-go-server.run.xml
index fb5f292..8d21e1a 100644
--- a/.run/registry/registry-nacos-go-server.run.xml
+++ b/.run/registry/registry-nacos-go-server.run.xml
@@ -1,15 +1,15 @@
 <component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="registry-nacos-go-server" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="registry">
-    <module name="dubbo-go-samples" />
-    <working_directory value="$PROJECT_DIR$" />
-    <envs>
-      <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/registry/nacos/go-server/conf/log.yml" />
-      <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/registry/nacos/go-server/conf/dubbogo.yml" />
-    </envs>
-    <kind value="PACKAGE" />
-    <package value="github.com/apache/dubbo-go-samples/registry/nacos/go-server/cmd" />
-    <directory value="$PROJECT_DIR$" />
-    <filePath value="$PROJECT_DIR$/general/registry/nacos/go-server/cmd/server.go" />
-    <method v="2" />
-  </configuration>
-</component>
\ No newline at end of file
+    <configuration default="false" name="registry-nacos-go-server" type="GoApplicationRunConfiguration" factoryName="Go Application" folderName="registry">
+        <module name="dubbo-go-samples" />
+        <working_directory value="$PROJECT_DIR$" />
+        <envs>
+            <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/registry/nacos/go-server/conf/log.yml" />
+            <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/registry/nacos/go-server/conf/dubbogo.yml" />
+        </envs>
+        <kind value="PACKAGE" />
+        <package value="github.com/apache/dubbo-go-samples/registry/nacos/go-server/cmd" />
+        <directory value="$PROJECT_DIR$" />
+        <filePath value="$PROJECT_DIR$/general/registry/nacos/go-server/cmd/server.go" />
+        <method v="2" />
+    </configuration>
+</component>
diff --git a/context/dubbo/go-client/cmd/client.go b/context/dubbo/go-client/cmd/client.go
index f6fd0a2..09f944a 100644
--- a/context/dubbo/go-client/cmd/client.go
+++ b/context/dubbo/go-client/cmd/client.go
@@ -20,50 +20,53 @@ package main
 import (
 	"context"
 	"os"
-	"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/constant"
-	_ "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/registry/protocol"
-	_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
-
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
 	hessian "github.com/apache/dubbo-go-hessian2"
-
 	"github.com/dubbogo/gost/log"
 )
 
-import (
-	pkg2 "github.com/apache/dubbo-go-samples/context/dubbo/go-client/pkg"
-)
+type UserProvider struct {
+	GetContext func(ctx context.Context, req *ContextContent) (rsp *ContextContent, err error)
+}
+
+func (u *UserProvider) Reference() string {
+	return "userProvider"
+}
 
-var userProvider = new(pkg2.UserProvider)
+type ContextContent struct {
+	Path              string
+	InterfaceName     string
+	DubboVersion      string
+	LocalAddr         string
+	RemoteAddr        string
+	UserDefinedStrVal string
+	CtxStrVal         string
+	CtxIntVal         int64
+}
 
-func init() {
-	config.SetConsumerService(userProvider)
-	hessian.RegisterPOJO(&pkg2.ContextContent{})
+func (*ContextContent) JavaClassName() string {
+	return "org.apache.dubbo.User"
 }
 
 // need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run
 func main() {
-	hessian.RegisterPOJO(&pkg2.ContextContent{})
+	var userProvider = &UserProvider{}
+	config.SetConsumerService(userProvider)
+	hessian.RegisterPOJO(&ContextContent{})
 	config.Load()
-	time.Sleep(3 * time.Second)
-
 	gxlog.CInfo("\n\n\nstart to test dubbo")
-	rspContent := &pkg2.ContextContent{}
+
 	atta := make(map[string]interface{})
 	atta["string-value"] = "string-demo"
 	atta["int-value"] = 1231242
-	atta["user-defined-value"] = pkg2.ContextContent{InterfaceName: "test.interface.name"}
+	atta["user-defined-value"] = ContextContent{InterfaceName: "test.interface.name"}
 	reqContext := context.WithValue(context.Background(), constant.DubboCtxKey("attachment"), atta)
-	err := userProvider.GetContext(reqContext, []interface{}{"A001"}, rspContent)
+	rspContent, err := userProvider.GetContext(reqContext, &ContextContent{CtxStrVal: "A001"})
 	if err != nil {
 		gxlog.CError("error: %v\n", err)
 		os.Exit(1)
diff --git a/context/dubbo/go-client/conf/client.yml b/context/dubbo/go-client/conf/client.yml
deleted file mode 100644
index 6af64f6..0000000
--- a/context/dubbo/go-client/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: "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: "GetContext"
-        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/context/dubbo/go-client/conf/dubbogo.yml b/context/dubbo/go-client/conf/dubbogo.yml
new file mode 100644
index 0000000..e4e74e3
--- /dev/null
+++ b/context/dubbo/go-client/conf/dubbogo.yml
@@ -0,0 +1,37 @@
+dubbo:
+  registries:
+    demoZK:
+      protocol: zookeeper
+      timeout: 3s
+      address: 127.0.0.1:2181
+  protocols:
+    dubbo:
+      name: dubbo
+      port: 20000
+      # 在 params 中定义当前使用的协议特有的网络配置
+      # 如该 sample 配置的是 dubbo 协议(底层使用 getty 通信库)的参数
+      params:
+        reconnect-interval: 2
+        connection-number: 1
+        heartbeat-period: 5s
+        session-timeout: 180s
+        pool-size: 64
+        pool-ttl: 600
+        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
+        tcp-read-timeout: 1s
+        tcp-write-timeout: 5s
+        wait-timeout: 1s
+        max-msg-len: 1024000
+        session-name: client
+  consumer:
+    registry:
+      - demoZK
+    references:
+      userProvider:
+        protocol: dubbo
+        interface: org.apache.dubbo.UserProvider
\ No newline at end of file
diff --git a/context/dubbo/go-client/conf/log.yml b/context/dubbo/go-client/conf/log.yml
deleted file mode 100644
index 2b6e93a..0000000
--- a/context/dubbo/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/context/dubbo/go-client/pkg/user.go b/context/dubbo/go-client/pkg/user.go
deleted file mode 100644
index 32d6eac..0000000
--- a/context/dubbo/go-client/pkg/user.go
+++ /dev/null
@@ -1,45 +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"
-)
-
-type ContextContent struct {
-	Path              string
-	InterfaceName     string
-	DubboVersion      string
-	LocalAddr         string
-	RemoteAddr        string
-	UserDefinedStrVal string
-	CtxStrVal         string
-	CtxIntVal         int64
-}
-
-type UserProvider struct {
-	GetContext func(ctx context.Context, req []interface{}, rsp *ContextContent) error
-}
-
-func (u *UserProvider) Reference() string {
-	return "UserProvider"
-}
-
-func (ContextContent) JavaClassName() string {
-	return "org.apache.dubbo.ContextContent"
-}
diff --git a/context/dubbo/go-server/cmd/server.go b/context/dubbo/go-server/cmd/server.go
index 8586f22..be81d87 100644
--- a/context/dubbo/go-server/cmd/server.go
+++ b/context/dubbo/go-server/cmd/server.go
@@ -18,6 +18,7 @@
 package main
 
 import (
+	"context"
 	"fmt"
 	"os"
 	"os/signal"
@@ -26,30 +27,68 @@ import (
 )
 
 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/constant"
 	"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/registry/protocol"
-	_ "dubbo.apache.org/dubbo-go/v3/registry/zookeeper"
-
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
 	hessian "github.com/apache/dubbo-go-hessian2"
-)
 
-import (
-	pkg2 "github.com/apache/dubbo-go-samples/context/dubbo/go-server/pkg"
+	gxlog "github.com/dubbogo/gost/log"
 )
 
 var (
 	survivalTimeout = int(3e9)
 )
 
+func init() {
+	config.SetProviderService(&UserProvider{})
+	// ------for hessian2------
+	hessian.RegisterPOJO(&ContextContent{})
+}
+
+type ContextContent struct {
+	Path              string
+	InterfaceName     string
+	DubboVersion      string
+	LocalAddr         string
+	RemoteAddr        string
+	UserDefinedStrVal string
+	CtxStrVal         string
+	CtxIntVal         int64
+}
+
+type UserProvider struct {
+}
+
+func (u *UserProvider) GetContext(ctx context.Context, req *ContextContent) (*ContextContent, error) {
+	gxlog.CInfo("req:%#v", req)
+	ctxAtta := ctx.Value(constant.DubboCtxKey("attachment")).(map[string]interface{})
+	userDefinedval := ctxAtta["user-defined-value"].(*ContextContent)
+	gxlog.CInfo("get user defined struct:%#v", userDefinedval)
+	rsp := ContextContent{
+		Path:              ctxAtta["path"].(string),
+		InterfaceName:     ctxAtta["interface"].(string),
+		DubboVersion:      ctxAtta["dubbo"].(string),
+		LocalAddr:         ctxAtta["local-addr"].(string),
+		RemoteAddr:        ctxAtta["remote-addr"].(string),
+		UserDefinedStrVal: userDefinedval.InterfaceName,
+		CtxIntVal:         ctxAtta["int-value"].(int64),
+		CtxStrVal:         ctxAtta["string-value"].(string),
+	}
+	gxlog.CInfo("rsp:%#v", rsp)
+	return &rsp, nil
+}
+
+func (u *UserProvider) Reference() string {
+	return "userProvider"
+}
+
+func (u ContextContent) JavaClassName() string {
+	return "org.apache.dubbo.User"
+}
+
 // need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run
 func main() {
-	hessian.RegisterPOJO(&pkg2.ContextContent{})
 	config.Load()
 
 	initSignal()
diff --git a/context/dubbo/go-server/conf/client.yml b/context/dubbo/go-server/conf/client.yml
deleted file mode 100644
index 3e547b4..0000000
--- a/context/dubbo/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: "GetContext"
-        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/context/dubbo/go-server/conf/dubbogo.yml b/context/dubbo/go-server/conf/dubbogo.yml
new file mode 100644
index 0000000..6728912
--- /dev/null
+++ b/context/dubbo/go-server/conf/dubbogo.yml
@@ -0,0 +1,33 @@
+dubbo:
+  registries:
+    demoZK:
+      protocol: zookeeper
+      timeout: 3s
+      address: 127.0.0.1:2181
+  protocols:
+    dubbo:
+      name: dubbo
+      port: 20000
+      # 在 params 中定义当前使用的协议特有的网络配置
+      # 如该 sample 配置的是 dubbo 协议(底层使用 getty 通信库)
+      params:
+        session-number: 700
+        session-timeout: 180s
+        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
+        tcp-read-timeout: 10s
+        tcp-write-timeout: 5s
+        wait-timeout: 1s
+        max-msg-len: 1024000
+        session-name: server
+  provider:
+    registry:
+      - demoZK
+    services:
+      userProvider:
+        protocol: dubbo
+        interface: org.apache.dubbo.UserProvider
\ No newline at end of file
diff --git a/context/dubbo/go-server/conf/log.yml b/context/dubbo/go-server/conf/log.yml
deleted file mode 100644
index 970d988..0000000
--- a/context/dubbo/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/context/dubbo/go-server/conf/server.yml b/context/dubbo/go-server/conf/server.yml
deleted file mode 100644
index 55354ee..0000000
--- a/context/dubbo/go-server/conf/server.yml
+++ /dev/null
@@ -1,55 +0,0 @@
-# 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: "GetContext"
-        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"
diff --git a/context/dubbo/go-server/docker/docker-compose.yml b/context/dubbo/go-server/docker/docker-compose.yml
deleted file mode 100644
index 8724179..0000000
--- a/context/dubbo/go-server/docker/docker-compose.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-version: '3'
-
-services:
-  zookeeper:
-    image: zookeeper
-    ports:
-      - 2181:2181
-    restart: on-failure
-
diff --git a/context/dubbo/go-server/docker/docker-health-check.sh b/context/dubbo/go-server/docker/docker-health-check.sh
deleted file mode 100644
index 2cc32c2..0000000
--- a/context/dubbo/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/context/dubbo/go-server/pkg/user.go b/context/dubbo/go-server/pkg/user.go
deleted file mode 100644
index b5bb759..0000000
--- a/context/dubbo/go-server/pkg/user.go
+++ /dev/null
@@ -1,78 +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"
-)
-
-import (
-	"dubbo.apache.org/dubbo-go/v3/common/constant"
-	"dubbo.apache.org/dubbo-go/v3/config"
-
-	hessian "github.com/apache/dubbo-go-hessian2"
-
-	"github.com/dubbogo/gost/log"
-)
-
-func init() {
-	config.SetProviderService(new(UserProvider))
-	// ------for hessian2------
-	hessian.RegisterPOJO(&ContextContent{})
-}
-
-type ContextContent struct {
-	Path              string
-	InterfaceName     string
-	DubboVersion      string
-	LocalAddr         string
-	RemoteAddr        string
-	UserDefinedStrVal string
-	CtxStrVal         string
-	CtxIntVal         int64
-}
-
-type UserProvider struct {
-}
-
-func (u *UserProvider) GetContext(ctx context.Context, req []interface{}) (*ContextContent, error) {
-	gxlog.CInfo("req:%#v", req)
-	ctxAtta := ctx.Value(constant.DubboCtxKey("attachment")).(map[string]interface{})
-	userDefinedval := ctxAtta["user-defined-value"].(*ContextContent)
-	gxlog.CInfo("get user defined struct:%#v", userDefinedval)
-	rsp := ContextContent{
-		Path:              ctxAtta["path"].(string),
-		InterfaceName:     ctxAtta["interface"].(string),
-		DubboVersion:      ctxAtta["dubbo"].(string),
-		LocalAddr:         ctxAtta["local-addr"].(string),
-		RemoteAddr:        ctxAtta["remote-addr"].(string),
-		UserDefinedStrVal: userDefinedval.InterfaceName,
-		CtxIntVal:         ctxAtta["int-value"].(int64),
-		CtxStrVal:         ctxAtta["string-value"].(string),
-	}
-	gxlog.CInfo("rsp:%#v", rsp)
-	return &rsp, nil
-}
-
-func (u *UserProvider) Reference() string {
-	return "UserProvider"
-}
-
-func (u ContextContent) JavaClassName() string {
-	return "org.apache.dubbo.ContextContent"
-}
diff --git a/context/dubbo/go-server/tests/integration/main_test.go b/context/dubbo/go-server/tests/integration/main_test.go
deleted file mode 100644
index 31fac6f..0000000
--- a/context/dubbo/go-server/tests/integration/main_test.go
+++ /dev/null
@@ -1,75 +0,0 @@
-// +build integration
-
-/*
- * 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 integration
-
-import (
-	"context"
-	"os"
-	"testing"
-	"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/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/metadata/service/local"
-	_ "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"
-)
-
-var userProvider = new(UserProvider)
-
-func TestMain(m *testing.M) {
-	config.SetConsumerService(userProvider)
-	hessian.RegisterPOJO(&ContextContent{})
-	config.Load()
-	time.Sleep(3 * time.Second)
-
-	os.Exit(m.Run())
-}
-
-type ContextContent struct {
-	Path              string
-	InterfaceName     string
-	DubboVersion      string
-	LocalAddr         string
-	RemoteAddr        string
-	UserDefinedStrVal string
-	CtxStrVal         string
-	CtxIntVal         int64
-}
-
-type UserProvider struct {
-	GetContext func(ctx context.Context, req []interface{}, rsp *ContextContent) error
-}
-
-func (u *UserProvider) Reference() string {
-	return "UserProvider"
-}
-
-func (ContextContent) JavaClassName() string {
-	return "org.apache.dubbo.ContextContent"
-}
diff --git a/context/dubbo/go-server/tests/integration/userprovider_test.go b/context/dubbo/go-server/tests/integration/userprovider_test.go
deleted file mode 100644
index 3c6a587..0000000
--- a/context/dubbo/go-server/tests/integration/userprovider_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// +build integration
-
-/*
- * 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 integration
-
-import (
-	"context"
-	"testing"
-)
-
-import (
-	"dubbo.apache.org/dubbo-go/v3/common/constant"
-
-	"github.com/stretchr/testify/assert"
-)
-
-func TestGetUser(t *testing.T) {
-	rspContext := &ContextContent{}
-
-	// add field that client wants to send
-	atta := make(map[string]interface{})
-	atta["string-value"] = "string-demo"
-	atta["int-value"] = 1231242
-	atta["user-defined-value"] = ContextContent{InterfaceName: "test.interface.name"}
-	reqContext := context.WithValue(context.Background(), constant.DubboCtxKey("attachment"), atta)
-
-	// invoke with reqContext
-	err := userProvider.GetContext(reqContext, []interface{}{"A001"}, rspContext)
-
-	// assert dubbo-go fields
-	assert.Nil(t, err)
-	assert.Equal(t, "org.apache.dubbo.UserProvider", rspContext.InterfaceName)
-	assert.Equal(t, "org.apache.dubbo.UserProvider", rspContext.Path)
-	assert.NotNil(t, rspContext.LocalAddr)
-	assert.NotNil(t, rspContext.RemoteAddr)
-	assert.NotNil(t, rspContext.DubboVersion)
-
-	// assert user defined fields
-	assert.Equal(t, "test.interface.name", rspContext.UserDefinedStrVal)
-	assert.Equal(t, "string-demo", rspContext.CtxStrVal)
-	assert.Equal(t, int64(1231242), rspContext.CtxIntVal)
-}
diff --git a/context/triple/go-client/cmd/client.go b/context/triple/go-client/cmd/client.go
index f3f19d3..b6109bb 100644
--- a/context/triple/go-client/cmd/client.go
+++ b/context/triple/go-client/cmd/client.go
@@ -49,11 +49,11 @@ func main() {
 	req := &api.HelloRequest{
 		Name: "laurence",
 	}
-	reply := &api.User{}
 	ctx := context.Background()
 	// set user defined context attachment
 	ctx = context.WithValue(ctx, tripleConstant.CtxAttachmentKey, "user-defined-value")
-	if err := grpcGreeterImpl.SayHello(ctx, req, reply); err != nil {
+	reply, err := grpcGreeterImpl.SayHello(ctx, req)
+	if err != nil {
 		logger.Error(err)
 	}
 	logger.Infof("client response result: %v\n", reply)
diff --git a/start_integrate_test.sh b/start_integrate_test.sh
index 9c4aebf..0116807 100755
--- a/start_integrate_test.sh
+++ b/start_integrate_test.sh
@@ -28,7 +28,7 @@
 #array+=("configcenter/zookeeper/go-server")
 #
 ## context
-#array+=("context/go-server")
+array+=("context/dubbo/go-server")
 #
 ## direct
 #array+=("direct/go-server")