Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions protocol/dubbo3/internal/client.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just delete this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK 那我就直接删除了

Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,4 @@
* limitations under the License.
*/

package internal

import (
"dubbo.apache.org/dubbo-go/v3/config"
)

// TODO: After the config is removed, remove the test
func init() {
// for pb client
config.SetConsumerServiceByInterfaceName("org.apache.dubbo.DubboGreeterImpl", &GreeterClientImpl{})
config.SetConsumerService(&GreeterClientImpl{})
}
package internal
28 changes: 1 addition & 27 deletions protocol/dubbo3/internal/server.go
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这几个internal路径里面的文件是用来干嘛的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

简单概括一下,大概是这些

protocol/dubbo3/internal/client.go
Dubbo3 客户端初始化,完成服务发现、调用参数封装,为 RPC 调用做准备

protocol/dubbo3/internal/server.go
Dubbo3 服务端启动逻辑,实现 SayHello 服务,绑定端口并监听客户端请求

protocol/grpc/internal/helloworld/client.go
gRPC 基础客户端,建立连接,用于发起普通 gRPC 请求

protocol/grpc/internal/routeguide/client.go
gRPC 流式客户端示例,实现服务端流、客户端流、双向流三种通信模式

Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import (
)

import (
"dubbo.apache.org/dubbo-go/v3/common"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
_ "dubbo.apache.org/dubbo-go/v3/metrics/prometheus"
_ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory"
Expand All @@ -42,28 +40,4 @@ type Server struct {
func (s *Server) SayHello(ctx context.Context, in *HelloRequest) (*HelloReply, error) {
log.Infof("Received: %v", in.GetName())
return &HelloReply{Message: "Hello " + in.GetName()}, nil
}

// InitDubboServer creates global gRPC server.
// TODO: After the config is removed, remove the test
func InitDubboServer() {
serviceConfig := config.NewServiceConfigBuilder().
SetInterface("org.apache.dubbo.DubboGreeterImpl").
SetProtocolIDs("tripleKey").Build()

providerConfig := config.NewProviderConfigBuilder().SetServices(map[string]*config.ServiceConfig{
common.GetReference(&Server{}): serviceConfig,
}).Build()

protocolConfig := config.NewProtocolConfigBuilder().SetName("tri").SetPort("20003").Build()

rootConfig := config.NewRootConfigBuilder().SetProvider(providerConfig).SetProtocols(map[string]*config.ProtocolConfig{
"tripleKey": protocolConfig,
}).Build()

config.SetProviderService(&Server{})
if err := rootConfig.Init(); err != nil {
panic(err)
}
rootConfig.Start()
}
}
9 changes: 0 additions & 9 deletions protocol/grpc/internal/helloworld/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ import (
"google.golang.org/grpc"
)

import (
"dubbo.apache.org/dubbo-go/v3/config"
)

func init() {
config.SetConsumerServiceByInterfaceName("io.grpc.examples.helloworld.GreeterGrpc$IGreeter", &GrpcGreeterImpl{})
config.SetConsumerService(&GrpcGreeterImpl{})
}

// GrpcGreeterImpl
// used for dubbo-grpc biz client
type GrpcGreeterImpl struct {
Expand Down
9 changes: 0 additions & 9 deletions protocol/grpc/internal/routeguide/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ import (
log "github.com/dubbogo/gost/log/logger"
)

import (
"dubbo.apache.org/dubbo-go/v3/config"
)

func init() {
config.SetConsumerServiceByInterfaceName("io.grpc.examples.helloworld.GreeterGrpc$RouteGuide", &RouteGuideClientImpl{})
config.SetConsumerService(&RouteGuideClientImpl{})
}

// PrintFeatures lists all the features within the given bounding Rectangle.
func PrintFeatures(stream RouteGuide_ListFeaturesClient) {
for {
Expand Down
Loading