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/04 06:25:38 UTC

[dubbo-go] branch config-enhance updated: fix: add triple attachment (#1436)

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.git


The following commit(s) were added to refs/heads/config-enhance by this push:
     new 3e0412e  fix: add triple attachment (#1436)
3e0412e is described below

commit 3e0412eab25070431ea7bc5aa59955f92aa49c9f
Author: Laurence <45...@users.noreply.github.com>
AuthorDate: Sat Sep 4 14:25:33 2021 +0800

    fix: add triple attachment (#1436)
---
 config/logger_config.go                            |   2 +
 config_center/apollo/impl_test.go                  |   1 +
 go.mod                                             |   4 +-
 go.sum                                             |  14 +--
 metadata/service/exporter/configurable/exporter.go |   5 +-
 protocol/dubbo3/dubbo3_invoker.go                  |   8 +-
 protocol/dubbo3/dubbo3_invoker_test.go             |   2 +-
 protocol/dubbo3/dubbo3_protocol.go                 |  12 +-
 protocol/dubbo3/dubbo3_protocol_test.go            |   2 +-
 protocol/dubbo3/internal/client.go                 |  26 +----
 protocol/dubbo3/internal/helloworld.pb.go          | 125 +++++++--------------
 protocol/dubbo3/internal/server.go                 |   3 +-
 protocol/jsonrpc/http_test.go                      |   3 +
 13 files changed, 78 insertions(+), 129 deletions(-)

diff --git a/config/logger_config.go b/config/logger_config.go
index d8f939c..de7e9b0 100644
--- a/config/logger_config.go
+++ b/config/logger_config.go
@@ -23,7 +23,9 @@ import (
 
 import (
 	"github.com/creasty/defaults"
+
 	"github.com/natefinch/lumberjack"
+
 	"go.uber.org/zap"
 	"go.uber.org/zap/zapcore"
 )
diff --git a/config_center/apollo/impl_test.go b/config_center/apollo/impl_test.go
index 4165e9a..e96ce8d 100644
--- a/config_center/apollo/impl_test.go
+++ b/config_center/apollo/impl_test.go
@@ -30,6 +30,7 @@ import (
 	"github.com/knadh/koanf"
 	"github.com/knadh/koanf/parsers/yaml"
 	"github.com/knadh/koanf/providers/rawbytes"
+
 	"github.com/stretchr/testify/assert"
 )
 
diff --git a/go.mod b/go.mod
index f281edc..262e256 100644
--- a/go.mod
+++ b/go.mod
@@ -12,9 +12,9 @@ require (
 	github.com/creasty/defaults v1.5.1
 	github.com/dubbogo/go-zookeeper v1.0.3
 	github.com/dubbogo/gost v1.11.16
-	github.com/dubbogo/triple v1.0.6-0.20210829063429-3fc89d0b1771
+	github.com/dubbogo/triple v1.0.6-0.20210904050749-5721796f3fd6
 	github.com/emicklei/go-restful/v3 v3.5.2
-	github.com/fsnotify/fsnotify v1.5.0
+	github.com/fsnotify/fsnotify v1.5.1
 	github.com/ghodss/yaml v1.0.0
 	github.com/go-co-op/gocron v0.1.1
 	github.com/go-playground/validator/v10 v10.7.0
diff --git a/go.sum b/go.sum
index 476df21..face8eb 100644
--- a/go.sum
+++ b/go.sum
@@ -153,12 +153,10 @@ github.com/dubbogo/gost v1.11.12/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZT
 github.com/dubbogo/gost v1.11.16 h1:fvOw8aKQ0BuUYuD+MaXAYFvT7tg2l7WAS5SL5gZJpFs=
 github.com/dubbogo/gost v1.11.16/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=
-github.com/dubbogo/net v0.0.3/go.mod h1:B6/ka3g8VzcyrmdCH4VkHP1K0aHeI37FmclS+TCwIBU=
-github.com/dubbogo/triple v1.0.6-0.20210826093718-8b877016f3bf h1:lj0hNwbjk7UpqyEYo6Kz4poTH4w5UfyqI4Gl6x3HEqo=
-github.com/dubbogo/triple v1.0.6-0.20210826093718-8b877016f3bf/go.mod h1:tCl0mV54+V8Br9z71sFbS1IQUG41QKZUrW6FGaLheM0=
-github.com/dubbogo/triple v1.0.6-0.20210829063429-3fc89d0b1771 h1:tJqD3Utmjnla5goePEWYfU77AlESStc8EGNzmGwF9lE=
-github.com/dubbogo/triple v1.0.6-0.20210829063429-3fc89d0b1771/go.mod h1:tCl0mV54+V8Br9z71sFbS1IQUG41QKZUrW6FGaLheM0=
+github.com/dubbogo/net v0.0.4 h1:Rn9aMPZwOiRE22YhtxmDEE3H0Q3cfVRNhuEjNMelJ/8=
+github.com/dubbogo/net v0.0.4/go.mod h1:1CGOnM7X3he+qgGNqjeADuE5vKZQx/eMSeUkpU3ujIc=
+github.com/dubbogo/triple v1.0.6-0.20210904050749-5721796f3fd6 h1:ZrCFQ/a0rgK5EBF9FiiSYvCmtC2sLzOoFAbqBVmsA94=
+github.com/dubbogo/triple v1.0.6-0.20210904050749-5721796f3fd6/go.mod h1:KbfU/uZDv+fJEqXYK3qI8m1iuBQ309QxiC0tvTf2pog=
 github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
 github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
 github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
@@ -194,8 +192,8 @@ github.com/frankban/quicktest v1.10.0 h1:Gfh+GAJZOAoKZsIZeZbdn2JF10kN1XHNvjsvQK8
 github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y=
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
-github.com/fsnotify/fsnotify v1.5.0 h1:NO5hkcB+srp1x6QmwvNZLeaOgbM8cmBTN32THzjvu2k=
-github.com/fsnotify/fsnotify v1.5.0/go.mod h1:BX0DCEr5pT4jm2CnQdVP1lFV521fcCNcyEeNp4DQQDk=
+github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
+github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
 github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs=
 github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
 github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
diff --git a/metadata/service/exporter/configurable/exporter.go b/metadata/service/exporter/configurable/exporter.go
index 8aa24ed..2b35b32 100644
--- a/metadata/service/exporter/configurable/exporter.go
+++ b/metadata/service/exporter/configurable/exporter.go
@@ -18,11 +18,14 @@
 package configurable
 
 import (
-	"github.com/pkg/errors"
 	"sync"
 )
 
 import (
+	"github.com/pkg/errors"
+)
+
+import (
 	"dubbo.apache.org/dubbo-go/v3/common"
 	"dubbo.apache.org/dubbo-go/v3/common/constant"
 	"dubbo.apache.org/dubbo-go/v3/common/logger"
diff --git a/protocol/dubbo3/dubbo3_invoker.go b/protocol/dubbo3/dubbo3_invoker.go
index 54d5be0..e2eb80d 100644
--- a/protocol/dubbo3/dubbo3_invoker.go
+++ b/protocol/dubbo3/dubbo3_invoker.go
@@ -132,6 +132,7 @@ func (di *DubboInvoker) Invoke(ctx context.Context, invocation protocol.Invocati
 	}
 
 	// append interface id to ctx
+	ctx = context.WithValue(ctx, tripleConstant.CtxAttachmentKey, invocation.Attachments())
 	ctx = context.WithValue(ctx, tripleConstant.InterfaceKey, di.BaseInvoker.GetURL().GetParam(constant.INTERFACE_KEY, ""))
 	in := make([]reflect.Value, 0, 16)
 	in = append(in, reflect.ValueOf(ctx))
@@ -141,8 +142,11 @@ func (di *DubboInvoker) Invoke(ctx context.Context, invocation protocol.Invocati
 	}
 
 	methodName := invocation.MethodName()
-
-	result.Err = di.client.Invoke(methodName, in, invocation.Reply())
+	triAttachmentWithErr := di.client.Invoke(methodName, in, invocation.Reply())
+	result.Err = triAttachmentWithErr.GetError()
+	for k, v := range triAttachmentWithErr.GetAttachments() {
+		result.Attachment(k, v)
+	}
 	result.Rest = invocation.Reply()
 	return &result
 }
diff --git a/protocol/dubbo3/dubbo3_invoker_test.go b/protocol/dubbo3/dubbo3_invoker_test.go
index abbb047..f1df040 100644
--- a/protocol/dubbo3/dubbo3_invoker_test.go
+++ b/protocol/dubbo3/dubbo3_invoker_test.go
@@ -35,7 +35,7 @@ import (
 )
 
 const (
-	mockDubbo3CommonUrl2 = "tri://127.0.0.1:20003/DubboGreeterImpl?accesslog=&anyhost=true&app.version=0.0.1&application=BDTService&async=false&bean.name=DubboGreeterImpl" +
+	mockDubbo3CommonUrl2 = "tri://127.0.0.1:20003/DubboGreeterImpl?accesslog=&anyhost=true&app.version=0.0.1&application=BDTService&async=false&bean.name=greeterImpl" +
 		"&category=providers&cluster=failover&dubbo=dubbo-provider-golang-2.6.0&environment=dev&execute.limit=&execute.limit.rejected.handler=&generic=false&group=&interface=org.apache.dubbo.DubboGreeterImpl" +
 		"&ip=192.168.1.106&loadbalance=random&methods.SayHello.loadbalance=random&methods.SayHello.retries=1&methods.SayHello.tps.limit.interval=&methods.SayHello.tps.limit.rate=&methods.SayHello.tps.limit.strategy=" +
 		"&methods.SayHello.weight=0&module=dubbogo+say-hello+client&name=BDTService&organization=ikurento.com&owner=ZX&pid=49427&reference.filter=cshutdown&registry.role=3&remote.timestamp=1576923717&retries=" +
diff --git a/protocol/dubbo3/dubbo3_protocol.go b/protocol/dubbo3/dubbo3_protocol.go
index d8f27ff..e53b6a4 100644
--- a/protocol/dubbo3/dubbo3_protocol.go
+++ b/protocol/dubbo3/dubbo3_protocol.go
@@ -25,6 +25,7 @@ import (
 )
 
 import (
+	tripleCommon "github.com/dubbogo/triple/pkg/common"
 	tripleConstant "github.com/dubbogo/triple/pkg/common/constant"
 	triConfig "github.com/dubbogo/triple/pkg/config"
 	"github.com/dubbogo/triple/pkg/triple"
@@ -189,8 +190,15 @@ func (d *UnaryService) GetReqParamsInterfaces(methodName string) ([]interface{},
 }
 
 func (d *UnaryService) InvokeWithArgs(ctx context.Context, methodName string, arguments []interface{}) (interface{}, error) {
-	res := d.proxyImpl.Invoke(ctx, invocation.NewRPCInvocation(methodName, arguments, nil))
-	return res.Result(), res.Error()
+	dubboAttachment := make(map[string]interface{})
+	tripleAttachment, ok := ctx.Value(tripleConstant.TripleAttachement).(tripleCommon.TripleAttachment)
+	if ok {
+		for k, v := range tripleAttachment {
+			dubboAttachment[k] = v
+		}
+	}
+	res := d.proxyImpl.Invoke(ctx, invocation.NewRPCInvocation(methodName, arguments, dubboAttachment))
+	return res, res.Error()
 }
 
 // openServer open a dubbo3 server, if there is already a service using the same protocol, it returns directly.
diff --git a/protocol/dubbo3/dubbo3_protocol_test.go b/protocol/dubbo3/dubbo3_protocol_test.go
index f924bf8..95e485d 100644
--- a/protocol/dubbo3/dubbo3_protocol_test.go
+++ b/protocol/dubbo3/dubbo3_protocol_test.go
@@ -36,7 +36,7 @@ import (
 )
 
 const (
-	mockDubbo3CommonUrl = "tri://127.0.0.1:20002/DubboGreeterImpl?accesslog=&anyhost=true&app.version=0.0.1&application=BDTService&async=false&bean.name=DubboGreeterImpl" +
+	mockDubbo3CommonUrl = "tri://127.0.0.1:20002/DubboGreeterImpl?accesslog=&anyhost=true&app.version=0.0.1&application=BDTService&async=false&bean.name=greeterImpl" +
 		"&category=providers&cluster=failover&dubbo=dubbo-provider-golang-2.6.0&environment=dev&execute.limit=&execute.limit.rejected.handler=&generic=false&group=&interface=org.apache.dubbo.DubboGreeterImpl" +
 		"&ip=192.168.1.106&loadbalance=random&methods.SayHello.loadbalance=random&methods.SayHello.retries=1&methods.SayHello.tps.limit.interval=&methods.SayHello.tps.limit.rate=&methods.SayHello.tps.limit.strategy=" +
 		"&methods.SayHello.weight=0&module=dubbogo+say-hello+client&name=BDTService&organization=ikurento.com&owner=ZX&pid=49427&reference.filter=cshutdown&registry.role=3&remote.timestamp=1576923717&retries=" +
diff --git a/protocol/dubbo3/internal/client.go b/protocol/dubbo3/internal/client.go
index 2b1d8e0..a182054 100644
--- a/protocol/dubbo3/internal/client.go
+++ b/protocol/dubbo3/internal/client.go
@@ -18,33 +18,9 @@
 package internal
 
 import (
-	"context"
-)
-
-import (
-	"github.com/dubbogo/triple/pkg/triple"
-)
-
-import (
 	"dubbo.apache.org/dubbo-go/v3/config"
 )
 
 func init() {
-	config.SetConsumerService(&GrpcGreeterImpl{})
-}
-
-// GrpcGreeterImpl
-//used for dubbo3 biz client
-type GrpcGreeterImpl struct {
-	SayHello func(ctx context.Context, in *HelloRequest, out *HelloReply) error
-}
-
-// Reference ...
-func (u *GrpcGreeterImpl) Reference() string {
-	return "DubboGreeterImpl"
-}
-
-// GetDubboStub ...
-func (u *GrpcGreeterImpl) GetDubboStub(cc *triple.TripleConn) GreeterClient {
-	return NewGreeterDubbo3Client(cc)
+	config.SetConsumerService(&GreeterClientImpl{})
 }
diff --git a/protocol/dubbo3/internal/helloworld.pb.go b/protocol/dubbo3/internal/helloworld.pb.go
index 404d7e3..e265b30 100644
--- a/protocol/dubbo3/internal/helloworld.pb.go
+++ b/protocol/dubbo3/internal/helloworld.pb.go
@@ -27,14 +27,13 @@ import (
 )
 
 import (
+	"github.com/dubbogo/triple/pkg/common"
 	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"
 )
 
 import (
@@ -157,106 +156,50 @@ var fileDescriptor_17b8c58d586b62f2 = []byte{
 	0x20, 0x00, 0x00, 0xff, 0xff, 0xc4, 0x20, 0xe8, 0xd3, 0xef, 0x00, 0x00, 0x00,
 }
 
-// Reference imports to suppress errors if they are not otherwise used.
-var _ context.Context
-
-// 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) (*HelloReply, error)
-}
-
-type greeterClient struct {
-	cc *grpc.ClientConn
+type greeterDubbo3Client struct {
+	cc *dubbo3.TripleConn
 }
 
-func NewGreeterClient(cc *grpc.ClientConn) GreeterClient {
-	return &greeterClient{cc}
+func NewGreeterDubbo3Client(cc *dubbo3.TripleConn) GreeterClient {
+	return &greeterDubbo3Client{cc}
 }
-
-func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
+func (c *greeterDubbo3Client) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, common.ErrorWithAttachment) {
 	out := new(HelloReply)
-	err := c.cc.Invoke(ctx, "/internal.Greeter/SayHello", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
+	interfaceKey := ctx.Value(tripleConstant.InterfaceKey).(string)
+	return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SayHello", in, out)
 }
 
-// GreeterServer is the server API for Greeter service.
-type GreeterServer interface {
+// 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 GreeterClient interface {
 	// Sends a greeting
-	SayHello(context.Context, *HelloRequest) (*HelloReply, error)
+	SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, common.ErrorWithAttachment)
 }
 
-// UnimplementedGreeterServer can be embedded to have forward compatible implementations.
-type UnimplementedGreeterServer struct {
+type GreeterClientImpl struct {
+	// Sends a greeting
+	SayHello func(ctx context.Context, in *HelloRequest) (*HelloReply, error)
 }
 
-func (*UnimplementedGreeterServer) SayHello(ctx context.Context, req *HelloRequest) (*HelloReply, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
+type Greeter_SayHelloClient interface {
+	CloseAndRecv() (*HelloReply, error)
+	grpc.ClientStream
 }
 
-func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
-	s.RegisterService(&_Greeter_serviceDesc, srv)
+type greeterSayHelloClient struct {
+	grpc.ClientStream
 }
 
-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 {
+func (x *greeterSayHelloClient) CloseAndRecv() (*HelloReply, error) {
+	if err := x.ClientStream.CloseSend(); err != nil {
 		return nil, err
 	}
-	if interceptor == nil {
-		return srv.(GreeterServer).SayHello(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/internal.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: "internal.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) (*HelloReply, error) {
-	out := new(HelloReply)
-	interfaceKey := ctx.Value(tripleConstant.InterfaceKey).(string)
-	err := c.cc.Invoke(ctx, "/"+interfaceKey+"/SayHello", in, out)
-	if err != nil {
+	m := new(HelloReply)
+	if err := x.ClientStream.RecvMsg(m); 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 *HelloReply) error
+	return m, nil
 }
 
 func (c *GreeterClientImpl) Reference() string {
@@ -267,6 +210,12 @@ func (c *GreeterClientImpl) GetDubboStub(cc *dubbo3.TripleConn) GreeterClient {
 	return NewGreeterDubbo3Client(cc)
 }
 
+// GreeterServer is the server API for Greeter service.
+type GreeterServer interface {
+	// Sends a greeting
+	SayHello(context.Context, *HelloRequest) (*HelloReply, error)
+}
+
 type GreeterProviderBase struct {
 	proxyImpl protocol.Invoker
 }
@@ -279,7 +228,11 @@ func (s *GreeterProviderBase) GetProxyImpl() protocol.Invoker {
 	return s.proxyImpl
 }
 
-func _DUBBO_Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func (c *GreeterProviderBase) Reference() string {
+	return "greeterImpl"
+}
+
+func _Triple_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
@@ -290,7 +243,7 @@ func _DUBBO_Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec f
 	invo := invocation.NewRPCInvocation("SayHello", args, nil)
 	if interceptor == nil {
 		result := base.GetProxyImpl().Invoke(ctx, invo)
-		return result.Result(), result.Error()
+		return result, result.Error()
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
@@ -310,7 +263,7 @@ func (s *GreeterProviderBase) ServiceDesc() *grpc.ServiceDesc {
 		Methods: []grpc.MethodDesc{
 			{
 				MethodName: "SayHello",
-				Handler:    _DUBBO_Greeter_SayHello_Handler,
+				Handler:    _Triple_Greeter_SayHello_Handler,
 			},
 		},
 		Streams:  []grpc.StreamDesc{},
diff --git a/protocol/dubbo3/internal/server.go b/protocol/dubbo3/internal/server.go
index ad9e747..2eaca3e 100644
--- a/protocol/dubbo3/internal/server.go
+++ b/protocol/dubbo3/internal/server.go
@@ -23,6 +23,7 @@ import (
 )
 
 import (
+	"dubbo.apache.org/dubbo-go/v3/common"
 	_ "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"
@@ -47,7 +48,7 @@ func InitDubboServer() {
 	)
 
 	providerConfig := config.NewProviderConfig(
-		config.WithProviderService("Server", serviceConfig),
+		config.WithProviderService(common.GetReference(&Server{}), serviceConfig),
 	)
 
 	protocolConfig := config.NewProtocolConfig(
diff --git a/protocol/jsonrpc/http_test.go b/protocol/jsonrpc/http_test.go
index d42d828..855c918 100644
--- a/protocol/jsonrpc/http_test.go
+++ b/protocol/jsonrpc/http_test.go
@@ -19,6 +19,9 @@ package jsonrpc
 
 import (
 	"context"
+)
+
+import (
 	perrors "github.com/pkg/errors"
 )