You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by wu...@apache.org on 2025/05/22 10:08:26 UTC

(dubbo-go) branch develop updated: feat: support new triple non-IDL mode (#2858)

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

wuxinfan pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/develop by this push:
     new 2bb56d28e feat: support new triple non-IDL mode (#2858)
2bb56d28e is described below

commit 2bb56d28e05555c427cda2d4d6cc926bb9779ef5
Author: marsevilspirit <ma...@gmail.com>
AuthorDate: Thu May 22 18:08:22 2025 +0800

    feat: support new triple non-IDL mode (#2858)
    
    * support triple non-idl mode server side
    
    * support new triple non-idl mode client side
    
    * fix multi-protocols bug
    
    * remove unused debug log and comment
    
    * refactor IDL mode in url and rich log output
    
    * add some todo
    
    * support dubbo.load
    
    * Ensure that isIDL does not have any other invalid inputs.
    
    * fix comment
    
    * fix comment
    
    * fix golanglint-ci error
---
 client/action.go                    | 16 +++++++++++
 client/client.go                    | 54 +++++++++++++++++++++++++++++++++----
 client/options.go                   |  8 ++++++
 common/constant/key.go              | 10 +++++++
 common/rpc_service.go               | 32 +++++++++++-----------
 config/service_config.go            | 18 ++++++-------
 dubbo.go                            | 47 ++++++++++++++++++++++++++++----
 global/reference_config.go          |  5 ++++
 protocol/triple/client.go           | 37 ++++++++++++++++++++-----
 protocol/triple/server.go           | 26 +++++++++++++-----
 protocol/triple/triple.go           |  5 +++-
 proxy/proxy_factory/default.go      |  2 +-
 proxy/proxy_factory/pass_through.go |  2 +-
 registry/exposed_tmp/exposed.go     |  4 +--
 server/action.go                    | 44 ++++++++++++++++++++----------
 server/options.go                   | 13 +++++++++
 server/server.go                    | 25 ++++++++++++++---
 17 files changed, 277 insertions(+), 71 deletions(-)

diff --git a/client/action.go b/client/action.go
index c8c7efd6a..a96badb88 100644
--- a/client/action.go
+++ b/client/action.go
@@ -89,6 +89,10 @@ func (refOpts *ReferenceOptions) ReferWithService(srv common.RPCService) {
 	refOpts.refer(srv, nil)
 }
 
+func (refOpts *ReferenceOptions) Refer() {
+	refOpts.refer(nil, nil)
+}
+
 func (refOpts *ReferenceOptions) ReferWithInfo(info *ClientInfo) {
 	refOpts.refer(nil, info)
 }
@@ -130,11 +134,23 @@ func (refOpts *ReferenceOptions) refer(srv common.RPCService, info *ClientInfo)
 		common.WithParamsValue(constant.TimeoutKey, refOpts.Consumer.RequestTimeout),
 		common.WithParamsValue(constant.KeepAliveInterval, ref.KeepAliveInterval),
 		common.WithParamsValue(constant.KeepAliveTimeout, ref.KeepAliveTimeout),
+		// for new triple non-IDL mode
+		// TODO: remove ISIDL after old triple removed
+		common.WithParamsValue(constant.IDLMode, ref.IDLMode),
 	)
+
+	// for new triple IDL mode
 	if info != nil {
 		cfgURL.SetAttribute(constant.ClientInfoKey, info)
 	}
 
+	// for new triple non-IDL mode
+	// It assists in passing the service,
+	// which is then parsed internally by new triple.
+	if srv != nil {
+		cfgURL.SetAttribute(constant.RpcServiceKey, srv)
+	}
+
 	if ref.ForceTag {
 		cfgURL.AddParam(constant.ForceUseTag, "true")
 	}
diff --git a/client/client.go b/client/client.go
index 69ad59cd0..da3daec97 100644
--- a/client/client.go
+++ b/client/client.go
@@ -20,6 +20,7 @@ package client
 
 import (
 	"context"
+	"errors"
 )
 
 import (
@@ -45,9 +46,24 @@ type ClientInfo struct {
 type ClientDefinition struct {
 	Svc  any
 	Info *ClientInfo
+	Conn *Connection
+}
+
+func (d *ClientDefinition) SetConnection(conn *Connection) {
+	d.Conn = conn
+}
+
+func (d *ClientDefinition) GetConnection() (*Connection, error) {
+	if d.Conn == nil {
+		return nil, errors.New("you need dubbo.load() first")
+	}
+	return d.Conn, nil
 }
 
 // InterfaceName/group/version /ReferenceConfig
+// TODO: In the Connection structure, we are only using the invoker in the refOpts.
+// Considering simplifying the Connection.
+// Make the structure of Connection more in line with human logic.
 type Connection struct {
 	refOpts *ReferenceOptions
 }
@@ -96,12 +112,33 @@ func (conn *Connection) CallBidiStream(ctx context.Context, methodName string, o
 	return res.Result(), res.Error()
 }
 
+func (cli *Client) NewService(service any, opts ...ReferenceOption) (*Connection, error) {
+	if service == nil {
+		return nil, errors.New("service must not be nil")
+	}
+
+	interfaceName := common.GetReference(service)
+
+	finalOpts := []ReferenceOption{
+		WithIDL(constant.NONIDL),
+		// default msgpack serialization
+		WithSerialization(constant.MsgpackSerialization),
+	}
+	finalOpts = append(finalOpts, opts...)
+
+	return cli.DialWithService(interfaceName, service, finalOpts...)
+}
+
 func (cli *Client) Dial(interfaceName string, opts ...ReferenceOption) (*Connection, error) {
-	return cli.dial(interfaceName, nil, opts...)
+	return cli.dial(interfaceName, nil, nil, opts...)
+}
+
+func (cli *Client) DialWithService(interfaceName string, service any, opts ...ReferenceOption) (*Connection, error) {
+	return cli.dial(interfaceName, nil, service, opts...)
 }
 
 func (cli *Client) DialWithInfo(interfaceName string, info *ClientInfo, opts ...ReferenceOption) (*Connection, error) {
-	return cli.dial(interfaceName, info, opts...)
+	return cli.dial(interfaceName, info, nil, opts...)
 }
 
 func (cli *Client) DialWithDefinition(interfaceName string, definition *ClientDefinition, opts ...ReferenceOption) (*Connection, error) {
@@ -115,10 +152,10 @@ func (cli *Client) DialWithDefinition(interfaceName string, definition *ClientDe
 		opts = append(opts, setReference(ref))
 	}
 
-	return cli.dial(interfaceName, definition.Info, opts...)
+	return cli.dial(interfaceName, definition.Info, nil, opts...)
 }
 
-func (cli *Client) dial(interfaceName string, info *ClientInfo, opts ...ReferenceOption) (*Connection, error) {
+func (cli *Client) dial(interfaceName string, info *ClientInfo, srv any, opts ...ReferenceOption) (*Connection, error) {
 	if err := metadata.InitRegistryMetadataReport(cli.cliOpts.Registries); err != nil {
 		return nil, err
 	}
@@ -137,7 +174,14 @@ func (cli *Client) dial(interfaceName string, info *ClientInfo, opts ...Referenc
 	if err := newRefOpts.init(finalOpts...); err != nil {
 		return nil, err
 	}
-	newRefOpts.ReferWithInfo(info)
+
+	if info != nil {
+		newRefOpts.ReferWithInfo(info)
+	} else if srv != nil {
+		newRefOpts.ReferWithService(srv)
+	} else {
+		newRefOpts.Refer()
+	}
 
 	return &Connection{refOpts: newRefOpts}, nil
 }
diff --git a/client/options.go b/client/options.go
index e2ffba8f3..c753e4888 100644
--- a/client/options.go
+++ b/client/options.go
@@ -98,6 +98,7 @@ func (refOpts *ReferenceOptions) init(opts ...ReferenceOption) error {
 	}
 
 	// init cluster
+	// TODO: use constant replace failover
 	if ref.Cluster == "" {
 		ref.Cluster = "failover"
 	}
@@ -332,6 +333,13 @@ func WithSticky() ReferenceOption {
 	}
 }
 
+// TODO: remove this function after old triple removed
+func WithIDL(IDLMode string) ReferenceOption {
+	return func(opts *ReferenceOptions) {
+		opts.Reference.IDLMode = IDLMode
+	}
+}
+
 // ========== Protocol to consume ==========
 
 func WithProtocolDubbo() ReferenceOption {
diff --git a/common/constant/key.go b/common/constant/key.go
index 8a357d426..b95b20196 100644
--- a/common/constant/key.go
+++ b/common/constant/key.go
@@ -64,6 +64,16 @@ const (
 	MaxServerRecvMsgSize   = "max-server-recv-msg-size"
 	KeepAliveInterval      = "keep-alive-interval"
 	KeepAliveTimeout       = "keep-alive-timeout"
+
+	// TODO: remove IDLMode after old triple removed
+	IDLMode = "IDL-mode"
+)
+
+// TODO: remove this after old triple removed
+// IDLMode
+const (
+	IDL    = "IDL"
+	NONIDL = "non-IDL"
 )
 
 // tls constant
diff --git a/common/rpc_service.go b/common/rpc_service.go
index 5992c7b77..6b27de6b5 100644
--- a/common/rpc_service.go
+++ b/common/rpc_service.go
@@ -142,10 +142,10 @@ func (m *MethodType) SuiteContext(ctx context.Context) reflect.Value {
 
 // Service is description of service
 type Service struct {
-	name     string
-	rcvr     reflect.Value
-	rcvrType reflect.Type
-	methods  map[string]*MethodType
+	name    string
+	svc     reflect.Value
+	svcType reflect.Type
+	methods map[string]*MethodType
 }
 
 // Method gets @s.methods.
@@ -158,14 +158,14 @@ func (s *Service) Name() string {
 	return s.name
 }
 
-// RcvrType gets @s.rcvrType.
-func (s *Service) RcvrType() reflect.Type {
-	return s.rcvrType
+// ServiceType gets @s.SvcType.
+func (s *Service) ServiceType() reflect.Type {
+	return s.svcType
 }
 
-// Rcvr gets @s.rcvr.
-func (s *Service) Rcvr() reflect.Value {
-	return s.rcvr
+// Service gets @s.Svc.
+func (s *Service) Service() reflect.Value {
+	return s.svc
 }
 
 type serviceMap struct {
@@ -204,7 +204,7 @@ func (sm *serviceMap) GetInterface(interfaceName string) []*Service {
 }
 
 // Register registers a service by @interfaceName and @protocol
-func (sm *serviceMap) Register(interfaceName, protocol, group, version string, rcvr RPCService) (string, error) {
+func (sm *serviceMap) Register(interfaceName, protocol, group, version string, svc RPCService) (string, error) {
 	if sm.serviceMap[protocol] == nil {
 		sm.serviceMap[protocol] = make(map[string]*Service)
 	}
@@ -213,11 +213,11 @@ func (sm *serviceMap) Register(interfaceName, protocol, group, version string, r
 	}
 
 	s := new(Service)
-	s.rcvrType = reflect.TypeOf(rcvr)
-	s.rcvr = reflect.ValueOf(rcvr)
-	sname := reflect.Indirect(s.rcvr).Type().Name()
+	s.svcType = reflect.TypeOf(svc)
+	s.svc = reflect.ValueOf(svc)
+	sname := reflect.Indirect(s.svc).Type().Name()
 	if sname == "" {
-		s := "no service name for type " + s.rcvrType.String()
+		s := "no service name for type " + s.svcType.String()
 		logger.Errorf(s)
 		return "", perrors.New(s)
 	}
@@ -236,7 +236,7 @@ func (sm *serviceMap) Register(interfaceName, protocol, group, version string, r
 
 	// Install the methods
 	methods := ""
-	methods, s.methods = suitableMethods(s.rcvrType)
+	methods, s.methods = suitableMethods(s.svcType)
 
 	if len(s.methods) == 0 {
 		s := "type " + sname + " has no exported methods of suitable type"
diff --git a/config/service_config.go b/config/service_config.go
index cb9ab4631..6cfbfd09d 100644
--- a/config/service_config.go
+++ b/config/service_config.go
@@ -257,25 +257,25 @@ func (s *ServiceConfig) Export() error {
 	ports := getRandomPort(protocolConfigs)
 	nextPort := ports.Front()
 
-	for _, proto := range protocolConfigs {
+	for _, protocolConf := range protocolConfigs {
 		// registry the service reflect
-		methods, err := common.ServiceMap.Register(s.Interface, proto.Name, s.Group, s.Version, s.rpcService)
+		methods, err := common.ServiceMap.Register(s.Interface, protocolConf.Name, s.Group, s.Version, s.rpcService)
 		if err != nil {
 			formatErr := perrors.Errorf("The service %v export the protocol %v error! Error message is %v.",
-				s.Interface, proto.Name, err.Error())
+				s.Interface, protocolConf.Name, err.Error())
 			logger.Errorf(formatErr.Error())
 			return formatErr
 		}
 
-		port := proto.Port
-		if num, err := strconv.Atoi(proto.Port); err != nil || num <= 0 {
+		port := protocolConf.Port
+		if num, err := strconv.Atoi(protocolConf.Port); err != nil || num <= 0 {
 			port = nextPort.Value.(string)
 			nextPort = nextPort.Next()
 		}
 		ivkURL := common.NewURLWithOptions(
 			common.WithPath(s.Interface),
-			common.WithProtocol(proto.Name),
-			common.WithIp(proto.Ip),
+			common.WithProtocol(protocolConf.Name),
+			common.WithIp(protocolConf.Ip),
 			common.WithPort(port),
 			common.WithParams(urlMap),
 			common.WithParamsValue(constant.BeanNameKey, s.id),
@@ -285,8 +285,8 @@ func (s *ServiceConfig) Export() error {
 			common.WithToken(s.Token),
 			common.WithParamsValue(constant.MetadataTypeKey, s.metadataType),
 			// fix https://github.com/apache/dubbo-go/issues/2176
-			common.WithParamsValue(constant.MaxServerSendMsgSize, proto.MaxServerSendMsgSize),
-			common.WithParamsValue(constant.MaxServerRecvMsgSize, proto.MaxServerRecvMsgSize),
+			common.WithParamsValue(constant.MaxServerSendMsgSize, protocolConf.MaxServerSendMsgSize),
+			common.WithParamsValue(constant.MaxServerRecvMsgSize, protocolConf.MaxServerRecvMsgSize),
 		)
 		info := GetProviderServiceInfo(s.id)
 		if info != nil {
diff --git a/dubbo.go b/dubbo.go
index 6546ea3bd..d4d3c5358 100644
--- a/dubbo.go
+++ b/dubbo.go
@@ -18,13 +18,12 @@
 package dubbo
 
 import (
+	"errors"
 	"sync"
 )
 
 import (
 	"github.com/dubbogo/gost/log/logger"
-
-	"github.com/pkg/errors"
 )
 
 import (
@@ -186,7 +185,9 @@ func (ins *Instance) start() (err error) {
 
 // loadProvider loads the service provider.
 func (ins *Instance) loadProvider() error {
+	var err error
 	var srvOpts []server.ServerOption
+
 	if ins.insOpts.Provider != nil {
 		srvOpts = append(srvOpts, server.SetServerProvider(ins.insOpts.Provider))
 	}
@@ -198,7 +199,13 @@ func (ins *Instance) loadProvider() error {
 	proLock.RLock()
 	defer proLock.RUnlock()
 	for _, definition := range providerServices {
-		if err = srv.Register(definition.Handler, definition.Info, definition.Opts...); err != nil {
+		if definition.Info != nil {
+			err = srv.Register(definition.Handler, definition.Info, definition.Opts...)
+		} else {
+			// if Info in nil, it means non-idl mode
+			err = srv.RegisterService(definition.Handler, definition.Opts...)
+		}
+		if err != nil {
 			return err
 		}
 	}
@@ -220,11 +227,21 @@ func (ins *Instance) loadConsumer() error {
 	conLock.RLock()
 	defer conLock.RUnlock()
 	for intfName, definition := range consumerServices {
-		conn, dialErr := cli.DialWithDefinition(intfName, definition)
+		var (
+			conn    *client.Connection
+			dialErr error
+		)
+		if definition.Info != nil {
+			conn, dialErr = cli.DialWithDefinition(intfName, definition)
+			definition.Info.ConnectionInjectFunc(definition.Svc, conn)
+		} else {
+			// default use msgpack
+			conn, dialErr = cli.NewService(definition.Svc)
+			consumerServices[common.GetReference(definition.Svc)].SetConnection(conn)
+		}
 		if dialErr != nil {
 			return dialErr
 		}
-		definition.Info.ConnectionInjectFunc(definition.Svc, conn)
 	}
 	return nil
 }
@@ -248,3 +265,23 @@ func SetProviderServiceWithInfo(svc common.RPCService, info *common.ServiceInfo)
 		Info:    info,
 	}
 }
+
+func SetConsumerService(svc common.RPCService) {
+	conLock.Lock()
+	defer conLock.Unlock()
+	consumerServices[common.GetReference(svc)] = &client.ClientDefinition{
+		Svc: svc,
+	}
+}
+
+func SetProviderService(svc common.RPCService) {
+	conLock.Lock()
+	defer conLock.Unlock()
+	providerServices[common.GetReference(svc)] = &server.ServiceDefinition{
+		Handler: svc,
+	}
+}
+
+func GetConsumerService(interfaceName string) (*client.Connection, error) {
+	return consumerServices[interfaceName].GetConnection()
+}
diff --git a/global/reference_config.go b/global/reference_config.go
index ff035d6e6..4519df285 100644
--- a/global/reference_config.go
+++ b/global/reference_config.go
@@ -47,6 +47,10 @@ type ReferenceConfig struct {
 	MeshProviderPort  int               `yaml:"mesh-provider-port" json:"mesh-provider-port,omitempty" propertiy:"mesh-provider-port"`
 	KeepAliveInterval string            `yaml:"keep-alive-interval" json:"keep-alive-interval,omitempty" property:"keep-alive-interval"`
 	KeepAliveTimeout  string            `yaml:"keep-alive-timeout" json:"keep-alive-timeout,omitempty" property:"keep-alive-timeout"`
+
+	// just for new triple non-IDL mode
+	// TODO: remove IDLMode when config package is removed
+	IDLMode string
 }
 
 func DefaultReferenceConfig() *ReferenceConfig {
@@ -185,6 +189,7 @@ func (c *ReferenceConfig) Clone() *ReferenceConfig {
 		MeshProviderPort:  c.MeshProviderPort,
 		KeepAliveInterval: c.KeepAliveInterval,
 		KeepAliveTimeout:  c.KeepAliveTimeout,
+		IDLMode:           c.IDLMode,
 	}
 }
 
diff --git a/protocol/triple/client.go b/protocol/triple/client.go
index 1cc34d44f..29d3c97f1 100644
--- a/protocol/triple/client.go
+++ b/protocol/triple/client.go
@@ -23,6 +23,7 @@ import (
 	"fmt"
 	"net"
 	"net/http"
+	"reflect"
 	"strings"
 )
 
@@ -74,7 +75,7 @@ func (cm *clientManager) callUnary(ctx context.Context, method string, req, resp
 		return err
 	}
 
-	serverAttachments, ok := ctx.Value(constant.AttachmentServerKey).(map[string]interface{})
+	serverAttachments, ok := ctx.Value(constant.AttachmentServerKey).(map[string]any)
 	if !ok {
 		return nil
 	}
@@ -244,13 +245,35 @@ func newClientManager(url *common.URL) (*clientManager, error) {
 		baseTriURL = httpPrefix + baseTriURL
 	}
 	triClients := make(map[string]*tri.Client)
-	for _, method := range url.Methods {
-		triURL, err := joinPath(baseTriURL, url.Interface(), method)
-		if err != nil {
-			return nil, fmt.Errorf("JoinPath failed for base %s, interface %s, method %s", baseTriURL, url.Interface(), method)
+
+	if len(url.Methods) != 0 {
+		for _, method := range url.Methods {
+			triURL, err := joinPath(baseTriURL, url.Interface(), method)
+			if err != nil {
+				return nil, fmt.Errorf("JoinPath failed for base %s, interface %s, method %s", baseTriURL, url.Interface(), method)
+			}
+			triClient := tri.NewClient(httpClient, triURL, cliOpts...)
+			triClients[method] = triClient
+		}
+	} else {
+		// This branch is for the non-IDL mode, where we pass in the service solely
+		// for the purpose of using reflection to obtain all methods of the service.
+		// There might be potential for optimization in this area later on.
+		service, ok := url.GetAttribute(constant.RpcServiceKey)
+		if !ok {
+			return nil, fmt.Errorf("triple clientmanager can't get methods")
+		}
+
+		serviceType := reflect.TypeOf(service)
+		for i := range serviceType.NumMethod() {
+			methodName := serviceType.Method(i).Name
+			triURL, err := joinPath(baseTriURL, url.Interface(), methodName)
+			if err != nil {
+				return nil, fmt.Errorf("JoinPath failed for base %s, interface %s, method %s", baseTriURL, url.Interface(), methodName)
+			}
+			triClient := tri.NewClient(httpClient, triURL, cliOpts...)
+			triClients[methodName] = triClient
 		}
-		triClient := tri.NewClient(httpClient, triURL, cliOpts...)
-		triClients[method] = triClient
 	}
 
 	return &clientManager{
diff --git a/protocol/triple/server.go b/protocol/triple/server.go
index 2e5bcd7ec..f2aa62915 100644
--- a/protocol/triple/server.go
+++ b/protocol/triple/server.go
@@ -108,7 +108,15 @@ func (s *Server) Start(invoker protocol.Invoker, info *common.ServiceInfo) {
 		logger.Infof("TRIPLE Server initialized the TLSConfig configuration")
 	}
 
-	// todo:// move tls config to handleService
+	// IDLMode means that this will only be set when
+	// the new triple is started in non-IDL mode.
+	// TODO: remove IDLMode when config package is removed
+	IDLMode := URL.GetParam(constant.IDLMode, "")
+
+	var service common.RPCService
+	if IDLMode == constant.NONIDL {
+		service, _ = URL.GetAttribute(constant.RpcServiceKey)
+	}
 
 	hanOpts := getHanOpts(URL)
 	//Set expected codec name from serviceinfo
@@ -118,8 +126,13 @@ func (s *Server) Start(invoker protocol.Invoker, info *common.ServiceInfo) {
 		// new triple idl mode
 		s.handleServiceWithInfo(intfName, invoker, info, hanOpts...)
 		s.saveServiceInfo(intfName, info)
+	} else if IDLMode == constant.NONIDL {
+		// new triple non-idl mode
+		reflectInfo := createServiceInfoWithReflection(service)
+		s.handleServiceWithInfo(intfName, invoker, reflectInfo, hanOpts...)
+		s.saveServiceInfo(intfName, reflectInfo)
 	} else {
-		// old triple idl mode and non-idl mode
+		// old triple idl mode and old triple non-idl mode
 		s.compatHandleService(intfName, URL.Group(), URL.Version(), hanOpts...)
 	}
 	internal.ReflectionRegister(s)
@@ -433,15 +446,14 @@ func (s *Server) GracefulStop() {
 // As a result, Server could use this ServiceInfo to register.
 func createServiceInfoWithReflection(svc common.RPCService) *common.ServiceInfo {
 	var info common.ServiceInfo
-	val := reflect.ValueOf(svc)
-	typ := reflect.TypeOf(svc)
-	methodNum := val.NumMethod()
+	svcType := reflect.TypeOf(svc)
+	methodNum := svcType.NumMethod()
 
 	// +1 for generic call method
 	methodInfos := make([]common.MethodInfo, 0, methodNum+1)
 
-	for i := 0; i < methodNum; i++ {
-		methodType := typ.Method(i)
+	for i := range methodNum {
+		methodType := svcType.Method(i)
 		if methodType.Name == "Reference" {
 			continue
 		}
diff --git a/protocol/triple/triple.go b/protocol/triple/triple.go
index 7a94497c7..a7e426e1a 100644
--- a/protocol/triple/triple.go
+++ b/protocol/triple/triple.go
@@ -93,9 +93,12 @@ func (tp *TripleProtocol) openServer(invoker protocol.Invoker, info *common.Serv
 func (tp *TripleProtocol) Refer(url *common.URL) protocol.Invoker {
 	var invoker protocol.Invoker
 	var err error
+
+	IDLMode := url.GetParam(constant.IDLMode, "")
 	// for now, we do not need to use this info
 	_, ok := url.GetAttribute(constant.ClientInfoKey)
-	if ok {
+	// isIDL is NONIDL means new triple non-IDL mode
+	if ok || IDLMode == constant.NONIDL {
 		// stub code generated by new protoc-gen-go-triple
 		invoker, err = NewTripleInvoker(url)
 	} else {
diff --git a/proxy/proxy_factory/default.go b/proxy/proxy_factory/default.go
index 4c6276faa..388eacd9b 100644
--- a/proxy/proxy_factory/default.go
+++ b/proxy/proxy_factory/default.go
@@ -122,7 +122,7 @@ func (pi *ProxyInvoker) Invoke(ctx context.Context, invocation protocol.Invocati
 		return result
 	}
 
-	in := []reflect.Value{svc.Rcvr()}
+	in := []reflect.Value{svc.Service()}
 	if method.CtxType() != nil {
 		ctx = context.WithValue(ctx, constant.AttachmentKey, invocation.Attachments())
 		in = append(in, method.SuiteContext(ctx))
diff --git a/proxy/proxy_factory/pass_through.go b/proxy/proxy_factory/pass_through.go
index 0a5e6dffc..736889d29 100644
--- a/proxy/proxy_factory/pass_through.go
+++ b/proxy/proxy_factory/pass_through.go
@@ -102,7 +102,7 @@ func (pi *PassThroughProxyInvoker) Invoke(ctx context.Context, invocation protoc
 	method := srv.Method()["Service"]
 
 	in := make([]reflect.Value, 0, 5)
-	in = append(in, srv.Rcvr())
+	in = append(in, srv.Service())
 	in = append(in, reflect.ValueOf(invocation.MethodName()))
 	in = append(in, reflect.ValueOf(invocation.GetAttachmentInterface(constant.ParamsTypeKey)))
 	in = append(in, reflect.ValueOf(args))
diff --git a/registry/exposed_tmp/exposed.go b/registry/exposed_tmp/exposed.go
index d4a1b77c4..3f4a26fb1 100644
--- a/registry/exposed_tmp/exposed.go
+++ b/registry/exposed_tmp/exposed.go
@@ -30,8 +30,8 @@ import (
 // RegisterServiceInstance register service instance
 func RegisterServiceInstance() error {
 	defer func() {
-		// TODO remove this recover func,this just to avoid some unit test failed,this will not happen in user side mostly
-		// config test -> metadata exporter -> dubbo protocol/remoting -> config,cycle import will occur
+		// TODO: remove this recover func, this just to avoid some unit test failed, this will not happen in user side mostly
+		// config test -> metadata exporter -> dubbo protocol/remoting -> config, cycle import will occur
 		// some day we fix the cycle import then can remove this recover
 		if err := recover(); err != nil {
 			logger.Errorf("register service instance failed,please check if registry protocol is imported, error: %v", err)
diff --git a/server/action.go b/server/action.go
index e741ed0ea..72e64c947 100644
--- a/server/action.go
+++ b/server/action.go
@@ -139,9 +139,11 @@ func (svcOpts *ServiceOptions) export(info *common.ServiceInfo) error {
 		if svc.Interface == "" {
 			svc.Interface = info.InterfaceName
 		}
-		svcOpts.Id = common.GetReference(svcOpts.rpcService)
 		svcOpts.info = info
 	}
+
+	svcOpts.Id = common.GetReference(svcOpts.rpcService)
+
 	// TODO: delay needExport
 	if svcOpts.unexported != nil && svcOpts.unexported.Load() {
 		err := perrors.Errorf("The service %v has already unexported!", svc.Interface)
@@ -168,43 +170,55 @@ func (svcOpts *ServiceOptions) export(info *common.ServiceInfo) error {
 	var invoker protocol.Invoker
 	ports := getRandomPort(protocolConfigs)
 	nextPort := ports.Front()
-	for _, proto := range protocolConfigs {
+	for _, protocolConf := range protocolConfigs {
 		// *important* Register should have been replaced by processing of ServiceInfo.
 		// but many modules like metadata need to make use of information from ServiceMap.
 		// todo(DMwangnimg): finish replacing procedure
 
 		// registry the service reflect
-		methods, err := common.ServiceMap.Register(svc.Interface, proto.Name, svc.Group, svc.Version, svcOpts.rpcService)
+		methods, err := common.ServiceMap.Register(svc.Interface, protocolConf.Name, svc.Group, svc.Version, svcOpts.rpcService)
 		if err != nil {
 			formatErr := perrors.Errorf("The service %v needExport the protocol %v error! Error message is %v.",
-				svc.Interface, proto.Name, err.Error())
+				svc.Interface, protocolConf.Name, err.Error())
 			logger.Errorf(formatErr.Error())
 			return formatErr
 		}
 
-		port := proto.Port
-		if len(proto.Port) == 0 {
+		port := protocolConf.Port
+		if len(protocolConf.Port) == 0 {
 			port = nextPort.Value.(string)
 			nextPort = nextPort.Next()
 		}
+
+		// Ensure that isIDL does not have any other invalid inputs.
+		isIDL := constant.IDL
+		if svcOpts.IDLMode == constant.NONIDL {
+			isIDL = svcOpts.IDLMode
+		}
+
 		ivkURL := common.NewURLWithOptions(
 			common.WithPath(svc.Interface),
-			common.WithProtocol(proto.Name),
-			common.WithIp(proto.Ip),
+			common.WithProtocol(protocolConf.Name),
+			common.WithIp(protocolConf.Ip),
 			common.WithPort(port),
 			common.WithParams(urlMap),
 			common.WithParamsValue(constant.BeanNameKey, svcOpts.Id),
 			common.WithParamsValue(constant.ApplicationTagKey, svcOpts.Application.Tag),
 			//common.WithParamsValue(constant.SslEnabledKey, strconv.FormatBool(config.GetSslEnabled())),
 			common.WithMethods(strings.Split(methods, ",")),
-			// todo(DMwangnima): remove this
-			common.WithAttribute(constant.ServiceInfoKey, info),
+			common.WithAttribute(constant.RpcServiceKey, svcOpts.rpcService),
 			common.WithToken(svc.Token),
 			common.WithParamsValue(constant.MetadataTypeKey, svcOpts.metadataType),
 			// fix https://github.com/apache/dubbo-go/issues/2176
-			common.WithParamsValue(constant.MaxServerSendMsgSize, proto.MaxServerSendMsgSize),
-			common.WithParamsValue(constant.MaxServerRecvMsgSize, proto.MaxServerRecvMsgSize),
+			common.WithParamsValue(constant.MaxServerSendMsgSize, protocolConf.MaxServerSendMsgSize),
+			common.WithParamsValue(constant.MaxServerRecvMsgSize, protocolConf.MaxServerRecvMsgSize),
+			common.WithParamsValue(constant.IDLMode, isIDL),
 		)
+
+		if info != nil {
+			ivkURL.SetAttribute(constant.ServiceInfoKey, info)
+		}
+
 		if len(svc.Tag) > 0 {
 			ivkURL.AddParam(constant.Tagkey, svc.Tag)
 		}
@@ -243,7 +257,7 @@ func (svcOpts *ServiceOptions) export(info *common.ServiceInfo) error {
 		}
 		// this protocol would be destroyed in graceful_shutdown
 		// please refer to (https://github.com/apache/dubbo-go/issues/2429)
-		graceful_shutdown.RegisterProtocol(proto.Name)
+		graceful_shutdown.RegisterProtocol(protocolConf.Name)
 	}
 	svcOpts.exported.Store(true)
 	return nil
@@ -253,8 +267,10 @@ func (svcOpts *ServiceOptions) generatorInvoker(url *common.URL, info *common.Se
 	proxyFactory := extension.GetProxyFactory(svcOpts.ProxyFactoryKey)
 	if info != nil {
 		url.SetAttribute(constant.ServiceInfoKey, info)
-		url.SetAttribute(constant.RpcServiceKey, svcOpts.rpcService)
 	}
+
+	url.SetAttribute(constant.RpcServiceKey, svcOpts.rpcService)
+
 	return proxyFactory.GetInvoker(url)
 }
 
diff --git a/server/options.go b/server/options.go
index 0f6ef9ad1..bd7e8bd55 100644
--- a/server/options.go
+++ b/server/options.go
@@ -469,6 +469,12 @@ type ServiceOptions struct {
 	exporters       []protocol.Exporter
 	adaptiveService bool
 
+	// for triple non-IDL mode
+	// consider put here or global.ServiceConfig
+	// string for url
+	// TODO: remove this when config package is remove
+	IDLMode string
+
 	methodsCompat     []*config.MethodConfig
 	applicationCompat *config.ApplicationConfig
 	registriesCompat  map[string]*config.RegistryConfig
@@ -871,6 +877,13 @@ func WithParam(k, v string) ServiceOption {
 	}
 }
 
+// TODO: remove when config package is removed
+func WithIDLMode(IDLMode string) ServiceOption {
+	return func(opts *ServiceOptions) {
+		opts.IDLMode = IDLMode
+	}
+}
+
 // ----------For framework----------
 // These functions should not be invoked by users
 
diff --git a/server/server.go b/server/server.go
index ea2d5b9e5..30991e93b 100644
--- a/server/server.go
+++ b/server/server.go
@@ -66,7 +66,9 @@ type ServiceDefinition struct {
 
 // Register assemble invoker chains like ProviderConfig.Load, init a service per call
 func (s *Server) Register(handler any, info *common.ServiceInfo, opts ...ServiceOption) error {
-	newSvcOpts, err := s.genSvcOpts(handler, opts...)
+	baseOpts := []ServiceOption{WithIDLMode(constant.IDL)}
+	baseOpts = append(baseOpts, opts...)
+	newSvcOpts, err := s.genSvcOpts(handler, baseOpts...)
 	if err != nil {
 		return err
 	}
@@ -74,6 +76,21 @@ func (s *Server) Register(handler any, info *common.ServiceInfo, opts ...Service
 	return nil
 }
 
+// RegisterService is for new Triple non-idl mode implement.
+func (s *Server) RegisterService(handler any, opts ...ServiceOption) error {
+	baseOpts := []ServiceOption{
+		WithIDLMode(constant.NONIDL),
+		WithInterface(common.GetReference(handler)),
+	}
+	baseOpts = append(baseOpts, opts...)
+	newSvcOpts, err := s.genSvcOpts(handler, baseOpts...)
+	if err != nil {
+		return err
+	}
+	s.svcOptsMap.Store(newSvcOpts, nil)
+	return nil
+}
+
 func (s *Server) genSvcOpts(handler any, opts ...ServiceOption) (*ServiceOptions, error) {
 	if s.cfg == nil {
 		return nil, errors.New("Server has not been initialized, please use NewServer() to create Server")
@@ -121,8 +138,10 @@ func (s *Server) exportServices() (err error) {
 			err = svcOpts.ExportWithoutInfo()
 		} else {
 			info := infoRaw.(*common.ServiceInfo)
-			//Add a method with a name of a differtent first-letter case
-			//to achieve interoperability with java
+			// Add a method with a name of a differtent first-letter case
+			// to achieve interoperability with java
+			// TODO: The method name case sensitivity in Dubbo-java should be addressed.
+			// We ought to make changes to handle this issue.
 			var additionalMethods []common.MethodInfo
 			for _, method := range info.Methods {
 				newMethod := method