diff --git a/cluster/router/chain/chain.go b/cluster/router/chain/chain.go index 612c12d87d463a86c6f9f85d4167100f55bf25ab..f55cd07bc9b360d3d79a7004bcc46ee8e8bc0d89 100644 --- a/cluster/router/chain/chain.go +++ b/cluster/router/chain/chain.go @@ -65,6 +65,8 @@ type RouterChain struct { notify chan struct{} // Address cache cache atomic.Value + // init + init sync.Once } // Route Loop routers in RouterChain and call Route method to determine the target invokers list. @@ -111,6 +113,13 @@ func (c *RouterChain) SetInvokers(invokers []protocol.Invoker) { c.invokers = invokers c.mutex.Unlock() + // it should trigger init router for first call + c.init.Do(func() { + go func() { + c.notify <- struct{}{} + }() + }) + c.count++ now := time.Now() if c.count >= countThreshold && now.Sub(c.last) >= timeThreshold { diff --git a/cluster/router/healthcheck/default_health_check.go b/cluster/router/healthcheck/default_health_check.go index 3effd779c989ed8e68c91eb6eab20d10d8b04e8c..378463be56a43f4934d23c340d81d66bfdeeea4c 100644 --- a/cluster/router/healthcheck/default_health_check.go +++ b/cluster/router/healthcheck/default_health_check.go @@ -96,7 +96,6 @@ func (c *DefaultHealthChecker) getCircuitBreakerSleepWindowTime(status *protocol return int64(sleepWindow) } - // GetRequestSuccessiveFailureThreshold return the requestSuccessiveFailureThreshold bound to this DefaultHealthChecker func (c *DefaultHealthChecker) GetRequestSuccessiveFailureThreshold() int32 { return c.requestSuccessiveFailureThreshold diff --git a/common/proxy/proxy.go b/common/proxy/proxy.go index d51ce1cc1bf40a8ad25804c797eeed3b88e7d132..c91aafecd7b0c21b034365ce92292e1cb82e455d 100644 --- a/common/proxy/proxy.go +++ b/common/proxy/proxy.go @@ -66,7 +66,6 @@ func NewProxy(invoke protocol.Invoker, callBack interface{}, attachments map[str // Yyy func(ctx context.Context, args []interface{}, rsp *Zzz) error // } func (p *Proxy) Implement(v common.RPCService) { - // check parameters, incoming interface must be a elem's pointer. valueOf := reflect.ValueOf(v) logger.Debugf("[Implement] reflect.TypeOf: %s", valueOf.String()) @@ -145,7 +144,7 @@ func (p *Proxy) Implement(v common.RPCService) { inv.SetAttachments(k, value) } - // add user setAttachment. It is compatibility with previous versions. + // add user setAttachment. It is compatibility with previous versions. atm := invCtx.Value(constant.AttachmentKey) if m, ok := atm.(map[string]string); ok { for k, value := range m { diff --git a/common/proxy/proxy_factory/default.go b/common/proxy/proxy_factory/default.go index 067c077294d9dfc1ade1cc2b1181b42f3ae4ba55..ff3d7955a027411b0697797d32a44023f8f70caf 100644 --- a/common/proxy/proxy_factory/default.go +++ b/common/proxy/proxy_factory/default.go @@ -97,7 +97,7 @@ func (pi *ProxyInvoker) Invoke(ctx context.Context, invocation protocol.Invocati args := invocation.Arguments() // get service - svc := common.ServiceMap.GetService(proto, path) + svc := common.ServiceMap.GetServiceByServiceKey(proto, url.ServiceKey()) if svc == nil { logger.Errorf("cannot find service [%s] in %s", path, proto) result.SetError(perrors.Errorf("cannot find service [%s] in %s", path, proto)) diff --git a/common/rpc_service.go b/common/rpc_service.go index 5ed4df6d717db31021d8585a88d5576f59756f8a..572fc71701c411a7a0a070c2a84e9a4d96da6dfb 100644 --- a/common/rpc_service.go +++ b/common/rpc_service.go @@ -157,11 +157,17 @@ type serviceMap struct { } // GetService gets a service defination by protocol and name -func (sm *serviceMap) GetService(protocol, name string) *Service { +func (sm *serviceMap) GetService(protocol, interfaceName, group, version string) *Service { + serviceKey := ServiceKey(interfaceName, group, version) + return sm.GetServiceByServiceKey(protocol, serviceKey) +} + +// GetService gets a service defination by protocol and service key +func (sm *serviceMap) GetServiceByServiceKey(protocol, serviceKey string) *Service { sm.mutex.RLock() defer sm.mutex.RUnlock() if s, ok := sm.serviceMap[protocol]; ok { - if srv, ok := s[name]; ok { + if srv, ok := s[serviceKey]; ok { return srv } return nil @@ -180,7 +186,7 @@ func (sm *serviceMap) GetInterface(interfaceName string) []*Service { } // Register registers a service by @interfaceName and @protocol -func (sm *serviceMap) Register(interfaceName, protocol string, rcvr RPCService) (string, error) { +func (sm *serviceMap) Register(interfaceName, protocol, group, version string, rcvr RPCService) (string, error) { if sm.serviceMap[protocol] == nil { sm.serviceMap[protocol] = make(map[string]*Service) } @@ -203,8 +209,8 @@ func (sm *serviceMap) Register(interfaceName, protocol string, rcvr RPCService) return "", perrors.New(s) } - sname = rcvr.Reference() - if server := sm.GetService(protocol, sname); server != nil { + sname = ServiceKey(interfaceName, group, version) + if server := sm.GetService(protocol, interfaceName, group, version); server != nil { return "", perrors.New("service already defined: " + sname) } s.name = sname @@ -228,9 +234,9 @@ func (sm *serviceMap) Register(interfaceName, protocol string, rcvr RPCService) } // UnRegister cancels a service by @interfaceName, @protocol and @serviceId -func (sm *serviceMap) UnRegister(interfaceName, protocol, serviceId string) error { - if protocol == "" || serviceId == "" { - return perrors.New("protocol or serviceName is nil") +func (sm *serviceMap) UnRegister(interfaceName, protocol, serviceKey string) error { + if protocol == "" || serviceKey == "" { + return perrors.New("protocol or serviceKey is nil") } var ( @@ -248,9 +254,9 @@ func (sm *serviceMap) UnRegister(interfaceName, protocol, serviceId string) erro if !ok { return perrors.New("no services for " + protocol) } - s, ok := svcs[serviceId] + s, ok := svcs[serviceKey] if !ok { - return perrors.New("no service for " + serviceId) + return perrors.New("no service for " + serviceKey) } svrs, ok = sm.interfaceMap[interfaceName] if !ok { @@ -276,7 +282,7 @@ func (sm *serviceMap) UnRegister(interfaceName, protocol, serviceId string) erro sm.interfaceMap[interfaceName] = append(sm.interfaceMap[interfaceName], svrs[i]) } } - delete(svcs, serviceId) + delete(svcs, serviceKey) if len(sm.serviceMap[protocol]) == 0 { delete(sm.serviceMap, protocol) } diff --git a/common/rpc_service_test.go b/common/rpc_service_test.go index 7c4eb421d7ed0e5e0306eb1a1a2ff5ac31c29b6d..b50d8d962c4277f702388b74e5137bdf1c8bdf7e 100644 --- a/common/rpc_service_test.go +++ b/common/rpc_service_test.go @@ -85,23 +85,23 @@ func TestServiceMapRegister(t *testing.T) { // lowercase s0 := &testService{} // methods, err := ServiceMap.Register("testporotocol", s0) - _, err := ServiceMap.Register(testInterfaceName, "testporotocol", s0) + _, err := ServiceMap.Register(testInterfaceName, "testporotocol", "", "v0", s0) assert.EqualError(t, err, "type testService is not exported") // succ s := &TestService{} - methods, err := ServiceMap.Register(testInterfaceName, "testporotocol", s) + methods, err := ServiceMap.Register(testInterfaceName, "testporotocol", "", "v1", s) assert.NoError(t, err) assert.Equal(t, "MethodOne,MethodThree,methodTwo", methods) // repeat - _, err = ServiceMap.Register(testInterfaceName, "testporotocol", s) - assert.EqualError(t, err, "service already defined: com.test.Path") + _, err = ServiceMap.Register(testInterfaceName, "testporotocol", "", "v1", s) + assert.EqualError(t, err, "service already defined: testService:v1") // no method s1 := &TestService1{} - _, err = ServiceMap.Register(testInterfaceName, "testporotocol", s1) - assert.EqualError(t, err, "type com.test.Path1 has no exported methods of suitable type") + _, err = ServiceMap.Register(testInterfaceName, "testporotocol", "", "v2", s1) + assert.EqualError(t, err, "type testService:v2 has no exported methods of suitable type") ServiceMap = &serviceMap{ serviceMap: make(map[string]map[string]*Service), @@ -111,22 +111,22 @@ func TestServiceMapRegister(t *testing.T) { func TestServiceMapUnRegister(t *testing.T) { s := &TestService{} - _, err := ServiceMap.Register("TestService", testProtocol, s) + _, err := ServiceMap.Register("TestService", testProtocol, "", "v1", s) assert.NoError(t, err) - assert.NotNil(t, ServiceMap.GetService(testProtocol, referenceTestPath)) + assert.NotNil(t, ServiceMap.GetService(testProtocol, "TestService", "", "v1")) assert.Equal(t, 1, len(ServiceMap.GetInterface("TestService"))) - err = ServiceMap.UnRegister("", "", referenceTestPath) - assert.EqualError(t, err, "protocol or serviceName is nil") + err = ServiceMap.UnRegister("", "", ServiceKey("TestService", "", "v1")) + assert.EqualError(t, err, "protocol or serviceKey is nil") - err = ServiceMap.UnRegister("", "protocol", referenceTestPath) + err = ServiceMap.UnRegister("", "protocol", ServiceKey("TestService", "", "v1")) assert.EqualError(t, err, "no services for protocol") - err = ServiceMap.UnRegister("", testProtocol, referenceTestPathDistinct) - assert.EqualError(t, err, "no service for com.test.Path1") + err = ServiceMap.UnRegister("", testProtocol, ServiceKey("TestService", "", "v0")) + assert.EqualError(t, err, "no service for TestService:v0") // succ - err = ServiceMap.UnRegister("TestService", testProtocol, referenceTestPath) + err = ServiceMap.UnRegister("TestService", testProtocol, ServiceKey("TestService", "", "v1")) assert.NoError(t, err) } diff --git a/common/url.go b/common/url.go index d8f096bb48991e0697297010813bcb880a30d148..efb4dfce14f72e4563d6136e64a7739dc79ef04d 100644 --- a/common/url.go +++ b/common/url.go @@ -109,7 +109,7 @@ type URL struct { noCopy noCopy baseUrl - Path string // like /com.ikurento.dubbo.UserProvider3 + Path string // like /com.ikurento.dubbo.UserProvider Username string Password string Methods []string diff --git a/config/application_config.go b/config/application_config.go index ef99664fa298c28365ed7acc54d0c18a88c9b5c2..6fe6c5d049f8ce95a56fcfd62eb1cffc03bf3c43 100644 --- a/config/application_config.go +++ b/config/application_config.go @@ -48,8 +48,5 @@ func (c *ApplicationConfig) UnmarshalYAML(unmarshal func(interface{}) error) err return err } type plain ApplicationConfig - if err := unmarshal((*plain)(c)); err != nil { - return err - } - return nil + return unmarshal((*plain)(c)) } diff --git a/config/base_config.go b/config/base_config.go index 336bb03c7b61ad8aad8465bb3c7754abeb9e9f5a..0cc6eec26c51cb7dfc164a3d43545f6b22658ca0 100644 --- a/config/base_config.go +++ b/config/base_config.go @@ -33,10 +33,6 @@ import ( "github.com/apache/dubbo-go/common/logger" ) -type multiConfiger interface { - Prefix() string -} - // BaseConfig is the common configuration for provider and consumer type BaseConfig struct { ConfigCenterConfig *ConfigCenterConfig `yaml:"config_center" json:"config_center,omitempty"` diff --git a/config/config_center_config.go b/config/config_center_config.go index 752d9d45855c886a1d5122c6e7832196c7e9413b..3bb856415d77344658055f03ccc4a6edd8c0f48a 100644 --- a/config/config_center_config.go +++ b/config/config_center_config.go @@ -26,6 +26,7 @@ import ( import ( "github.com/creasty/defaults" + perrors "github.com/pkg/errors" ) import ( @@ -35,7 +36,6 @@ import ( "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/config_center" - perrors "github.com/pkg/errors" ) // ConfigCenterConfig is configuration for config center @@ -69,10 +69,7 @@ func (c *ConfigCenterConfig) UnmarshalYAML(unmarshal func(interface{}) error) er return err } type plain ConfigCenterConfig - if err := unmarshal((*plain)(c)); err != nil { - return err - } - return nil + return unmarshal((*plain)(c)) } // GetUrlMap gets url map from ConfigCenterConfig diff --git a/config/config_loader_test.go b/config/config_loader_test.go index 9b253030ff9b218f9756145c9bdefdf512a2e131..c3c3eb93526a51fe8f2041b17049144b4ec7b703 100644 --- a/config/config_loader_test.go +++ b/config/config_loader_test.go @@ -104,7 +104,7 @@ func TestLoad(t *testing.T) { conServices = map[string]common.RPCService{} proServices = map[string]common.RPCService{} - err := common.ServiceMap.UnRegister("com.MockService", "mock", "MockService") + err := common.ServiceMap.UnRegister("com.MockService", "mock", common.ServiceKey("com.MockService", "huadong_idc", "1.0.0")) assert.Nil(t, err) consumerConfig = nil providerConfig = nil @@ -143,7 +143,7 @@ func TestLoadWithSingleReg(t *testing.T) { conServices = map[string]common.RPCService{} proServices = map[string]common.RPCService{} - common.ServiceMap.UnRegister("com.MockService", "mock", "MockService") + common.ServiceMap.UnRegister("com.MockService", "mock", common.ServiceKey("com.MockService", "huadong_idc", "1.0.0")) consumerConfig = nil providerConfig = nil } @@ -182,7 +182,7 @@ func TestWithNoRegLoad(t *testing.T) { conServices = map[string]common.RPCService{} proServices = map[string]common.RPCService{} - common.ServiceMap.UnRegister("com.MockService", "mock", "MockService") + common.ServiceMap.UnRegister("com.MockService", "mock", common.ServiceKey("com.MockService", "huadong_idc", "1.0.0")) consumerConfig = nil providerConfig = nil } diff --git a/config/consumer_config.go b/config/consumer_config.go index c8083603e12570a4492dd63a749adb4aa89663c8..ff53366c45406dde8e4c0daac7a5d68aa6bd8934 100644 --- a/config/consumer_config.go +++ b/config/consumer_config.go @@ -71,10 +71,7 @@ func (c *ConsumerConfig) UnmarshalYAML(unmarshal func(interface{}) error) error return err } type plain ConsumerConfig - if err := unmarshal((*plain)(c)); err != nil { - return err - } - return nil + return unmarshal((*plain)(c)) } // nolint diff --git a/config/method_config.go b/config/method_config.go index b64306fd6aa865d219506ea2722067619b00fea7..db52940c3db6b4b81b0467945b538c9b540cd46a 100644 --- a/config/method_config.go +++ b/config/method_config.go @@ -57,8 +57,5 @@ func (c *MethodConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { return err } type plain MethodConfig - if err := unmarshal((*plain)(c)); err != nil { - return err - } - return nil + return unmarshal((*plain)(c)) } diff --git a/config/provider_config.go b/config/provider_config.go index fcb429b6400936f72c09035968b4d4c72387246c..0aee5600298233b764df75b02c745a3ec8d9faef 100644 --- a/config/provider_config.go +++ b/config/provider_config.go @@ -58,10 +58,7 @@ func (c *ProviderConfig) UnmarshalYAML(unmarshal func(interface{}) error) error return err } type plain ProviderConfig - if err := unmarshal((*plain)(c)); err != nil { - return err - } - return nil + return unmarshal((*plain)(c)) } // nolint diff --git a/config/reference_config.go b/config/reference_config.go index 2e914ac9a718aaef93732fafa18f7d954cc0c5f6..05df3477362561644a841b147d67a660536ffdbc 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -86,17 +86,13 @@ func (c *ReferenceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error } *c = ReferenceConfig(raw) - if err := defaults.Set(c); err != nil { - return err - } - - return nil + return defaults.Set(c) } // Refer ... func (c *ReferenceConfig) Refer(_ interface{}) { cfgURL := common.NewURLWithOptions( - common.WithPath(c.id), + common.WithPath(c.InterfaceName), common.WithProtocol(c.Protocol), common.WithParams(c.getUrlMap()), common.WithParamsValue(constant.BEAN_NAME_KEY, c.id), @@ -117,7 +113,7 @@ func (c *ReferenceConfig) Refer(_ interface{}) { c.urls = append(c.urls, serviceUrl) } else { if serviceUrl.Path == "" { - serviceUrl.Path = "/" + c.id + serviceUrl.Path = "/" + c.InterfaceName } // merge url need to do newUrl := common.MergeUrl(serviceUrl, cfgURL) diff --git a/config/registry_config.go b/config/registry_config.go index 5aff45dc9f4dd20022255ada04cff78bbf295f3e..ed81a07c637e5de2972bbbd21dab8847c3d42f78 100644 --- a/config/registry_config.go +++ b/config/registry_config.go @@ -63,10 +63,7 @@ func (c *RegistryConfig) UnmarshalYAML(unmarshal func(interface{}) error) error return err } type plain RegistryConfig - if err := unmarshal((*plain)(c)); err != nil { - return err - } - return nil + return unmarshal((*plain)(c)) } // nolint diff --git a/config/service_config.go b/config/service_config.go index b3febc68d6143b77c08c6fafc5cda55c6e00ac05..32104f03ddba1c7a24a43a7989287a9b711565e7 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -171,7 +171,7 @@ func (c *ServiceConfig) Export() error { proxyFactory := extension.GetProxyFactory(providerConfig.ProxyFactory) for _, proto := range protocolConfigs { // registry the service reflect - methods, err := common.ServiceMap.Register(c.InterfaceName, proto.Name, c.rpcService) + methods, err := common.ServiceMap.Register(c.InterfaceName, proto.Name, c.Group, c.Version, c.rpcService) if err != nil { formatErr := perrors.Errorf("The service %v export the protocol %v error! Error message is %v.", c.InterfaceName, proto.Name, err.Error()) logger.Errorf(formatErr.Error()) @@ -184,7 +184,7 @@ func (c *ServiceConfig) Export() error { nextPort = nextPort.Next() } ivkURL := common.NewURLWithOptions( - common.WithPath(c.id), + common.WithPath(c.InterfaceName), common.WithProtocol(proto.Name), common.WithIp(proto.Ip), common.WithPort(port), diff --git a/filter/filter_impl/access_log_filter.go b/filter/filter_impl/access_log_filter.go index 6eaf9cb00bafe8fb0d4b9f8cda50e6bc7115461b..167b5edd804fd5b4b319e86d13815d1b4f698e1c 100644 --- a/filter/filter_impl/access_log_filter.go +++ b/filter/filter_impl/access_log_filter.go @@ -105,8 +105,12 @@ func (ef *AccessLogFilter) logIntoChannel(accessLogData AccessLogData) { func (ef *AccessLogFilter) buildAccessLogData(_ protocol.Invoker, invocation protocol.Invocation) map[string]string { dataMap := make(map[string]string, 16) attachments := invocation.Attachments() - if v, ok := attachments[constant.INTERFACE_KEY]; ok && v != nil { - dataMap[constant.INTERFACE_KEY] = v.(string) + itf := attachments[constant.INTERFACE_KEY] + if itf == nil || len(itf.(string)) == 0 { + itf = attachments[constant.PATH_KEY] + } + if itf != nil { + dataMap[constant.INTERFACE_KEY] = itf.(string) } if v, ok := attachments[constant.METHOD_KEY]; ok && v != nil { dataMap[constant.METHOD_KEY] = v.(string) diff --git a/filter/filter_impl/generic_service_filter.go b/filter/filter_impl/generic_service_filter.go index 3711e68cce67dacfec074a5e44c080a629bce305..89b009b8d136d34ca0fd14548b3ef5536c7234d8 100644 --- a/filter/filter_impl/generic_service_filter.go +++ b/filter/filter_impl/generic_service_filter.go @@ -20,7 +20,6 @@ package filter_impl import ( "context" "reflect" - "strings" ) import ( @@ -75,7 +74,7 @@ func (ef *GenericServiceFilter) Invoke(ctx context.Context, invoker protocol.Inv url := invoker.GetUrl() methodName = invocation.Arguments()[0].(string) // get service - svc := common.ServiceMap.GetService(url.Protocol, strings.TrimPrefix(url.Path, "/")) + svc := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey()) // get method method := svc.Method()[methodName] if method == nil { diff --git a/filter/filter_impl/generic_service_filter_test.go b/filter/filter_impl/generic_service_filter_test.go index 67819717cf07383373f905ed9420a42cc0bfddb9..8b2fb549c299bb6c1cf65c4254ba6784caec5655 100644 --- a/filter/filter_impl/generic_service_filter_test.go +++ b/filter/filter_impl/generic_service_filter_test.go @@ -96,7 +96,7 @@ func TestGenericServiceFilterInvoke(t *testing.T) { hessian.Object("222")}, } s := &TestService{} - _, _ = common.ServiceMap.Register("TestService", "testprotocol", s) + _, _ = common.ServiceMap.Register("com.test.Path", "testprotocol", "", "", s) rpcInvocation := invocation.NewRPCInvocation(methodName, aurguments, nil) filter := GetGenericServiceFilter() url, _ := common.NewURL("testprotocol://127.0.0.1:20000/com.test.Path") diff --git a/metadata/definition/definition_test.go b/metadata/definition/definition_test.go index 958f9324d0f9f4a5027792bd8e54b238a5f56feb..389159239b4f4d7156983c83096ead151561ad28 100644 --- a/metadata/definition/definition_test.go +++ b/metadata/definition/definition_test.go @@ -28,7 +28,6 @@ import ( import ( "github.com/apache/dubbo-go/common" - "github.com/apache/dubbo-go/common/constant" ) func TestBuildServiceDefinition(t *testing.T) { @@ -44,9 +43,9 @@ func TestBuildServiceDefinition(t *testing.T) { "owner=ZX&pid=1447&revision=0.0.1&side=provider&timeout=3000×tamp=1556509797245&group=%v&version=%v&bean.name=%v", protocol, serviceName, group, version, beanName)) assert.NoError(t, err) - _, err = common.ServiceMap.Register(serviceName, protocol, &UserProvider{}) + _, err = common.ServiceMap.Register(serviceName, protocol, group, version, &UserProvider{}) assert.NoError(t, err) - service := common.ServiceMap.GetService(url.Protocol, url.GetParam(constant.BEAN_NAME_KEY, url.Service())) + service := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey()) sd := BuildServiceDefinition(*service, url) assert.Equal(t, "{canonicalName:com.ikurento.user.UserProvider, codeSource:, methods:[{name:GetUser,parameterTypes:[{type:slice}],returnType:ptr,params:[] }], types:[]}", sd.String()) } diff --git a/metadata/report/delegate/delegate_report_test.go b/metadata/report/delegate/delegate_report_test.go index 3dfca577ba06598b90c553048777951c8823b256..9c30ed9ffdb8424be38d273fd0a78f3351d6e0d5 100644 --- a/metadata/report/delegate/delegate_report_test.go +++ b/metadata/report/delegate/delegate_report_test.go @@ -116,8 +116,8 @@ func getMockDefinition(id *identifier.MetadataIdentifier, t *testing.T) *definit "owner=ZX&pid=1447&revision=0.0.1&side=provider&timeout=3000×tamp=1556509797245&group=%v&version=%v&bean.name=%v", protocol, id.ServiceInterface, id.Group, id.Version, beanName)) assert.NoError(t, err) - _, err = common.ServiceMap.Register(id.ServiceInterface, protocol, &definition.UserProvider{}) + _, err = common.ServiceMap.Register(id.ServiceInterface, protocol, id.Group, id.Version, &definition.UserProvider{}) assert.NoError(t, err) - service := common.ServiceMap.GetService(url.Protocol, url.GetParam(constant.BEAN_NAME_KEY, url.Service())) + service := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey()) return definition.BuildServiceDefinition(*service, url) } diff --git a/metadata/service/exporter/configurable/exporter_test.go b/metadata/service/exporter/configurable/exporter_test.go index 2a5e646acdf86d2d9d339ae7ae377c7098b2e1b6..7c2baa2728b4c4888d9dbb117816648d72874c0b 100644 --- a/metadata/service/exporter/configurable/exporter_test.go +++ b/metadata/service/exporter/configurable/exporter_test.go @@ -69,7 +69,7 @@ func TestConfigurableExporter(t *testing.T) { assert.Equal(t, false, exported.IsExported()) assert.NoError(t, exported.Export(registryURL)) assert.Equal(t, true, exported.IsExported()) - assert.Regexp(t, "dubbo://:20003/MetadataService*", exported.GetExportedURLs()[0].String()) + assert.Regexp(t, "dubbo://:20003/org.apache.dubbo.metadata.MetadataService*", exported.GetExportedURLs()[0].String()) exported.Unexport() assert.Equal(t, false, exported.IsExported()) }) diff --git a/metadata/service/inmemory/service.go b/metadata/service/inmemory/service.go index d9cbd5430527511acac1f7127b819d3832d80552..8da78c34207c37a7f7e3f475502ac43e7d88b6fd 100644 --- a/metadata/service/inmemory/service.go +++ b/metadata/service/inmemory/service.go @@ -124,7 +124,7 @@ func (mts *MetadataService) getAllService(services *sync.Map) []*common.URL { urls := value.(*skip.SkipList) for i := uint64(0); i < urls.Len(); i++ { url := urls.ByPosition(i).(*common.URL) - if url.GetParam(constant.INTERFACE_KEY, url.Path) != constant.METADATA_SERVICE_NAME { + if url.Service() != constant.METADATA_SERVICE_NAME { res = append(res, url) } } @@ -178,7 +178,7 @@ func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error { interfaceName := url.GetParam(constant.INTERFACE_KEY, "") isGeneric := url.GetParamBool(constant.GENERIC_KEY, false) if len(interfaceName) > 0 && !isGeneric { - tmpService := common.ServiceMap.GetService(url.Protocol, url.GetParam(constant.BEAN_NAME_KEY, url.Service())) + tmpService := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey()) sd := definition.BuildServiceDefinition(*tmpService, url) data, err := sd.ToBytes() if err != nil { diff --git a/metadata/service/inmemory/service_test.go b/metadata/service/inmemory/service_test.go index 048c286fdf28fba6a15a86164df0789d421f0797..256412c2917d39c0ff15db11121718ba983cd7ab 100644 --- a/metadata/service/inmemory/service_test.go +++ b/metadata/service/inmemory/service_test.go @@ -82,7 +82,7 @@ func TestMetadataService(t *testing.T) { assert.Equal(t, 0, len(list4)) userProvider := &definition.UserProvider{} - common.ServiceMap.Register(serviceName, protocol, userProvider) + common.ServiceMap.Register(serviceName, protocol, group, version, userProvider) mts.PublishServiceDefinition(u) expected := "{\"CanonicalName\":\"com.ikurento.user.UserProvider\",\"CodeSource\":\"\"," + "\"Methods\":[{\"Name\":\"GetUser\",\"ParameterTypes\":[\"slice\"],\"ReturnType\":\"ptr\"," + diff --git a/metadata/service/remote/service.go b/metadata/service/remote/service.go index d1b17e8cd6fdddec82bd9864b231731763c1cfd1..efd16bdc6dad555f5a99bc4b2a02ee2a08202537 100644 --- a/metadata/service/remote/service.go +++ b/metadata/service/remote/service.go @@ -115,7 +115,7 @@ func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error { interfaceName := url.GetParam(constant.INTERFACE_KEY, "") isGeneric := url.GetParamBool(constant.GENERIC_KEY, false) if len(interfaceName) > 0 && !isGeneric { - sv := common.ServiceMap.GetService(url.Protocol, url.GetParam(constant.BEAN_NAME_KEY, url.Service())) + sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey()) sd := definition.BuildServiceDefinition(*sv, url) id := &identifier.MetadataIdentifier{ BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{ diff --git a/metadata/service/remote/service_test.go b/metadata/service/remote/service_test.go index 1cbe5eec0fb97dee1880a9580afa7ea0bd72ca44..71586cc1dcc87dc8644a25c9a89842bd84fe9f0a 100644 --- a/metadata/service/remote/service_test.go +++ b/metadata/service/remote/service_test.go @@ -126,7 +126,7 @@ func mockInmemoryProc(t *testing.T) *inmemory.MetadataService { _, err = mts.SubscribeURL(u) assert.NoError(t, err) - _, err = common.ServiceMap.Register(serviceName, protocol, userProvider) + _, err = common.ServiceMap.Register(serviceName, protocol, group, version, userProvider) assert.NoError(t, err) err = mts.PublishServiceDefinition(u) assert.NoError(t, err) diff --git a/metrics/prometheus/reporter.go b/metrics/prometheus/reporter.go index 810a13d87ce938a3b8a9d085f6d5ae6e3dc4c6ad..266c8206c5ea5b6dc07402943bcebdeb6dd7dea7 100644 --- a/metrics/prometheus/reporter.go +++ b/metrics/prometheus/reporter.go @@ -24,6 +24,7 @@ import ( "sync" "time" ) + import ( "github.com/prometheus/client_golang/prometheus" ) @@ -64,7 +65,6 @@ var ( // should initialize after loading configuration func init() { - extension.SetMetricReporter(reporterName, newPrometheusReporter) } @@ -72,12 +72,10 @@ func init() { // if you want to use this feature, you need to initialize your prometheus. // https://prometheus.io/docs/guides/go-application/ type PrometheusReporter struct { - // report the consumer-side's summary data consumerSummaryVec *prometheus.SummaryVec // report the provider-side's summary data providerSummaryVec *prometheus.SummaryVec - // report the provider-side's histogram data providerHistogramVec *prometheus.HistogramVec // report the consumer-side's histogram data diff --git a/metrics/prometheus/reporter_test.go b/metrics/prometheus/reporter_test.go index eaba0e324ff078bdfb2fd4b146ac9ea60d429724..1b9853f4d20739269861aac680b1ec491ef552d6 100644 --- a/metrics/prometheus/reporter_test.go +++ b/metrics/prometheus/reporter_test.go @@ -26,6 +26,7 @@ import ( import ( "github.com/stretchr/testify/assert" ) + import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/extension" diff --git a/metrics/reporter.go b/metrics/reporter.go index 9a7094fa62d9c0fa3e6ee0a8ef373f91c28d2c90..24d75aa4fe949737d7ca94cfd339a32af14a40be 100644 --- a/metrics/reporter.go +++ b/metrics/reporter.go @@ -21,6 +21,7 @@ import ( "context" "time" ) + import ( "github.com/apache/dubbo-go/protocol" ) diff --git a/protocol/dubbo/dubbo_exporter.go b/protocol/dubbo/dubbo_exporter.go index dd80937c5bdf6718c2047b102115d8c08afcd899..1873a63fe14f1e2bbb415d5a22c157d03f9ae6ee 100644 --- a/protocol/dubbo/dubbo_exporter.go +++ b/protocol/dubbo/dubbo_exporter.go @@ -42,10 +42,9 @@ func NewDubboExporter(key string, invoker protocol.Invoker, exporterMap *sync.Ma // Unexport unexport dubbo service exporter. func (de *DubboExporter) Unexport() { - serviceId := de.GetInvoker().GetUrl().GetParam(constant.BEAN_NAME_KEY, "") interfaceName := de.GetInvoker().GetUrl().GetParam(constant.INTERFACE_KEY, "") de.BaseExporter.Unexport() - err := common.ServiceMap.UnRegister(interfaceName, DUBBO, serviceId) + err := common.ServiceMap.UnRegister(interfaceName, DUBBO, de.GetInvoker().GetUrl().ServiceKey()) if err != nil { logger.Errorf("[DubboExporter.Unexport] error: %v", err) } diff --git a/protocol/dubbo/dubbo_invoker_test.go b/protocol/dubbo/dubbo_invoker_test.go index 49d853ee2dba51600692724afae830ae3c2f00a0..c7a9a2697529d096e57585347b0a8b0a535451b0 100644 --- a/protocol/dubbo/dubbo_invoker_test.go +++ b/protocol/dubbo/dubbo_invoker_test.go @@ -97,7 +97,7 @@ func InitTest(t *testing.T) (protocol.Protocol, *common.URL) { hessian.RegisterPOJO(&User{}) - methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "dubbo", &UserProvider{}) + methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "dubbo", "", "", &UserProvider{}) assert.NoError(t, err) assert.Equal(t, "GetBigPkg,GetUser,GetUser0,GetUser1,GetUser2,GetUser3,GetUser4,GetUser5,GetUser6", methods) diff --git a/protocol/dubbo/impl/codec.go b/protocol/dubbo/impl/codec.go index c139f3547b2af5196a38be9bc83f49251bfcf043..17e7b57b45f2334e06b757ee07e3a9ef034c920a 100644 --- a/protocol/dubbo/impl/codec.go +++ b/protocol/dubbo/impl/codec.go @@ -163,15 +163,12 @@ func (c *ProtocolCodec) Decode(p *DubboPackage) error { if p.IsResponseWithException() { logger.Infof("response with exception: %+v", p.Header) decoder := hessian.NewDecoder(body) + p.Body = &ResponsePayload{} exception, err := decoder.Decode() if err != nil { return perrors.WithStack(err) } - rsp, ok := p.Body.(*ResponsePayload) - if !ok { - return perrors.Errorf("java exception:%s", exception.(string)) - } - rsp.Exception = perrors.Errorf("java exception:%s", exception.(string)) + p.Body.(*ResponsePayload).Exception = perrors.Errorf("java exception:%s", exception.(string)) return nil } else if p.IsHeartBeat() { // heartbeat no need to unmarshal contents diff --git a/protocol/dubbo/impl/hessian.go b/protocol/dubbo/impl/hessian.go index 066400d58bebdbf7cfc0f6e172e9e1537a95ae1c..ccfa681aef787d18431bd16f072225b94c64fd47 100644 --- a/protocol/dubbo/impl/hessian.go +++ b/protocol/dubbo/impl/hessian.go @@ -385,7 +385,7 @@ func buildServerSidePackageBody(pkg *DubboPackage) { "dubboVersion": dubboVersion, "argsTypes": argsTypes, "args": args, - "service": common.ServiceMap.GetService(DUBBO, svc.Path), // path as a key + "service": common.ServiceMap.GetService(DUBBO, svc.Interface, svc.Group, svc.Version), // path as a key "attachments": attachments, }) } diff --git a/protocol/grpc/grpc_exporter.go b/protocol/grpc/grpc_exporter.go index 0dc764854d61576892800180041c53f0a7735c7c..5beb4fedb1aa0285288d5b2b52515d4f6b9498e8 100644 --- a/protocol/grpc/grpc_exporter.go +++ b/protocol/grpc/grpc_exporter.go @@ -42,10 +42,9 @@ func NewGrpcExporter(key string, invoker protocol.Invoker, exporterMap *sync.Map // Unexport and unregister gRPC service from registry and memory. func (gg *GrpcExporter) Unexport() { - serviceId := gg.GetInvoker().GetUrl().GetParam(constant.BEAN_NAME_KEY, "") interfaceName := gg.GetInvoker().GetUrl().GetParam(constant.INTERFACE_KEY, "") gg.BaseExporter.Unexport() - err := common.ServiceMap.UnRegister(interfaceName, GRPC, serviceId) + err := common.ServiceMap.UnRegister(interfaceName, GRPC, gg.GetInvoker().GetUrl().ServiceKey()) if err != nil { logger.Errorf("[GrpcExporter.Unexport] error: %v", err) } diff --git a/protocol/jsonrpc/http_test.go b/protocol/jsonrpc/http_test.go index 4a9645e828a3b092c938c62091fb400b05605b67..c4801c8db883353c82762162a7b658f964fc6ffa 100644 --- a/protocol/jsonrpc/http_test.go +++ b/protocol/jsonrpc/http_test.go @@ -49,7 +49,7 @@ type ( ) const ( - mockJsonCommonUrl = "jsonrpc://127.0.0.1:20001/UserProvider?anyhost=true&" + + mockJsonCommonUrl = "jsonrpc://127.0.0.1:20001/com.ikurento.user.UserProvider?anyhost=true&" + "application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" + "environment=dev&interface=com.ikurento.user.UserProvider&ip=192.168.56.1&methods=GetUser%2C&" + "module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" + @@ -58,7 +58,7 @@ const ( func TestHTTPClientCall(t *testing.T) { - methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "jsonrpc", &UserProvider{}) + methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "jsonrpc", "", "", &UserProvider{}) assert.NoError(t, err) assert.Equal(t, "GetUser,GetUser0,GetUser1,GetUser2,GetUser3,GetUser4", methods) diff --git a/protocol/jsonrpc/jsonrpc_exporter.go b/protocol/jsonrpc/jsonrpc_exporter.go index 6f75f6aeae9fb1a8d75ded5f558e0ddae84686a0..6b91d266a704d928bf1a308a79044055c9a64328 100644 --- a/protocol/jsonrpc/jsonrpc_exporter.go +++ b/protocol/jsonrpc/jsonrpc_exporter.go @@ -42,10 +42,9 @@ func NewJsonrpcExporter(key string, invoker protocol.Invoker, exporterMap *sync. // Unexport exported JSON RPC service. func (je *JsonrpcExporter) Unexport() { - serviceId := je.GetInvoker().GetUrl().GetParam(constant.BEAN_NAME_KEY, "") interfaceName := je.GetInvoker().GetUrl().GetParam(constant.INTERFACE_KEY, "") je.BaseExporter.Unexport() - err := common.ServiceMap.UnRegister(interfaceName, JSONRPC, serviceId) + err := common.ServiceMap.UnRegister(interfaceName, JSONRPC, je.GetInvoker().GetUrl().ServiceKey()) if err != nil { logger.Errorf("[JsonrpcExporter.Unexport] error: %v", err) } diff --git a/protocol/jsonrpc/jsonrpc_invoker.go b/protocol/jsonrpc/jsonrpc_invoker.go index f10aaad824cea9c953cf994bd7349b57f6bfffa8..357443f5d4efbe5159fb6c0e09d3dab51266dc73 100644 --- a/protocol/jsonrpc/jsonrpc_invoker.go +++ b/protocol/jsonrpc/jsonrpc_invoker.go @@ -45,10 +45,7 @@ func NewJsonrpcInvoker(url *common.URL, client *HTTPClient) *JsonrpcInvoker { // Invoke the JSON RPC invocation and return result. func (ji *JsonrpcInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result { - - var ( - result protocol.RPCResult - ) + var result protocol.RPCResult inv := invocation.(*invocation_impl.RPCInvocation) url := ji.GetUrl() diff --git a/protocol/jsonrpc/jsonrpc_invoker_test.go b/protocol/jsonrpc/jsonrpc_invoker_test.go index d7124ca07c6ba6d79dc72e7fb6bd98cd4b3a97b2..12a57052eba6e3a2af1b7cfb15e6ab368a7da286 100644 --- a/protocol/jsonrpc/jsonrpc_invoker_test.go +++ b/protocol/jsonrpc/jsonrpc_invoker_test.go @@ -36,13 +36,13 @@ import ( func TestJsonrpcInvokerInvoke(t *testing.T) { - methods, err := common.ServiceMap.Register("UserProvider", "jsonrpc", &UserProvider{}) + methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "jsonrpc", "", "", &UserProvider{}) assert.NoError(t, err) assert.Equal(t, "GetUser,GetUser0,GetUser1,GetUser2,GetUser3,GetUser4", methods) // Export proto := GetProtocol() - url, err := common.NewURL("jsonrpc://127.0.0.1:20001/UserProvider?anyhost=true&" + + url, err := common.NewURL("jsonrpc://127.0.0.1:20001/com.ikurento.user.UserProvider?anyhost=true&" + "application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" + "environment=dev&interface=com.ikurento.user.UserProvider&ip=192.168.56.1&methods=GetUser%2C&" + "module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" + diff --git a/protocol/rest/rest_exporter.go b/protocol/rest/rest_exporter.go index 359506a842437ba15c121c29b50478ae775a8ed7..7a49a2063559c2f4e9b4975bc86ea708abbfb026 100644 --- a/protocol/rest/rest_exporter.go +++ b/protocol/rest/rest_exporter.go @@ -42,10 +42,9 @@ func NewRestExporter(key string, invoker protocol.Invoker, exporterMap *sync.Map // Unexport unexport the RestExporter func (re *RestExporter) Unexport() { - serviceId := re.GetInvoker().GetUrl().GetParam(constant.BEAN_NAME_KEY, "") interfaceName := re.GetInvoker().GetUrl().GetParam(constant.INTERFACE_KEY, "") re.BaseExporter.Unexport() - err := common.ServiceMap.UnRegister(interfaceName, REST, serviceId) + err := common.ServiceMap.UnRegister(interfaceName, REST, re.GetInvoker().GetUrl().ServiceKey()) if err != nil { logger.Errorf("[RestExporter.Unexport] error: %v", err) } diff --git a/protocol/rest/rest_invoker_test.go b/protocol/rest/rest_invoker_test.go index 9df97a211e9d90daa3206b94926ceeac42df4606..18843d2ae4e8dc54683226f2fb0c325e58c7e4ed 100644 --- a/protocol/rest/rest_invoker_test.go +++ b/protocol/rest/rest_invoker_test.go @@ -65,7 +65,7 @@ func TestRestInvokerInvoke(t *testing.T) { url, err := common.NewURL(mockRestCommonUrl) assert.NoError(t, err) - _, err = common.ServiceMap.Register("UserProvider", url.Protocol, &UserProvider{}) + _, err = common.ServiceMap.Register(url.Service(), url.Protocol, "", "", &UserProvider{}) assert.NoError(t, err) con := config.ProviderConfig{} config.SetProviderConfig(con) @@ -210,6 +210,6 @@ func TestRestInvokerInvoke(t *testing.T) { assert.Error(t, res.Error(), "test error") assert.Equal(t, filterNum, 12) - err = common.ServiceMap.UnRegister("UserProvider", url.Protocol, "com.ikurento.user.UserProvider") + err = common.ServiceMap.UnRegister(url.Service(), url.Protocol, url.ServiceKey()) assert.NoError(t, err) } diff --git a/protocol/rest/rest_protocol_test.go b/protocol/rest/rest_protocol_test.go index 9ff4e7df7fe41d7fd028bf476cc2192cf7cefcca..580fc61fd6cfda731184eed6f785b80abc9fccfe 100644 --- a/protocol/rest/rest_protocol_test.go +++ b/protocol/rest/rest_protocol_test.go @@ -72,7 +72,7 @@ func TestRestProtocolExport(t *testing.T) { proto := GetRestProtocol() url, err := common.NewURL(mockRestCommonUrl) assert.NoError(t, err) - _, err = common.ServiceMap.Register("UserProvider", url.Protocol, &UserProvider{}) + _, err = common.ServiceMap.Register(url.Service(), url.Protocol, "", "", &UserProvider{}) assert.NoError(t, err) con := config.ProviderConfig{} config.SetProviderConfig(con) @@ -120,8 +120,6 @@ func TestRestProtocolExport(t *testing.T) { proto.Destroy() _, ok = proto.(*RestProtocol).serverMap[url.Location] assert.False(t, ok) - err = common.ServiceMap.UnRegister("UserProvider", url.Protocol, "com.ikurento.user.UserProvider") - assert.NoError(t, err) } type UserProvider struct { diff --git a/protocol/rest/server/rest_server.go b/protocol/rest/server/rest_server.go index 5ef04ff336cadccddbcc952b272c2ba91507f4fb..3a1cb19396b1c129aa836e228991a22426065f4a 100644 --- a/protocol/rest/server/rest_server.go +++ b/protocol/rest/server/rest_server.go @@ -23,7 +23,6 @@ import ( "net/http" "reflect" "strconv" - "strings" ) import ( @@ -90,7 +89,7 @@ func GetRouteFunc(invoker protocol.Invoker, methodConfig *rest_config.RestMethod err error args []interface{} ) - svc := common.ServiceMap.GetService(invoker.GetUrl().Protocol, strings.TrimPrefix(invoker.GetUrl().Path, "/")) + svc := common.ServiceMap.GetServiceByServiceKey(invoker.GetUrl().Protocol, invoker.GetUrl().ServiceKey()) // get method method := svc.Method()[methodConfig.MethodName] argsTypes := method.ArgsType() diff --git a/registry/consul/utils.go b/registry/consul/utils.go index 468dafb338e8413c66d00da974c860708a2e2210..76f5d2dd3378f67d300d10b4c5ecc72934ef7715 100644 --- a/registry/consul/utils.go +++ b/registry/consul/utils.go @@ -107,7 +107,7 @@ func retrieveURL(service *consul.ServiceEntry) (*common.URL, error) { func in(url *common.URL, urls []*common.URL) bool { for _, url1 := range urls { - if url.URLEqual(url1) { + if common.IsEquals(url, url1) { return true } } diff --git a/registry/directory/directory_test.go b/registry/directory/directory_test.go index dde944d62410cee6429dbbc408eb364a354f1613..9008e6ecb79993626bac19a8fcf6870532386b01 100644 --- a/registry/directory/directory_test.go +++ b/registry/directory/directory_test.go @@ -124,7 +124,7 @@ func Test_Destroy(t *testing.T) { func Test_List(t *testing.T) { registryDirectory, _ := normalRegistryDir() - time.Sleep(4e9) + time.Sleep(6e9) assert.Len(t, registryDirectory.List(&invocation.RPCInvocation{}), 3) assert.Equal(t, true, registryDirectory.IsAvailable()) diff --git a/remoting/getty/getty_client_test.go b/remoting/getty/getty_client_test.go index d49be5030a8d18d77f0f0ad61d9c5790494c1654..0b18e973cd2ea7a3f6aae59e822aaf68ee983331 100644 --- a/remoting/getty/getty_client_test.go +++ b/remoting/getty/getty_client_test.go @@ -211,7 +211,9 @@ func testGetUser3(t *testing.T, c *Client) { request := remoting.NewRequest("2.0.2") invocation := createInvocation("GetUser3", nil, nil, []interface{}{}, []reflect.Value{}) - attachment := map[string]string{INTERFACE_KEY: "com.ikurento.user.UserProvider"} + attachment := map[string]string{ + INTERFACE_KEY: "com.ikurento.user.UserProvider", + } setAttachment(invocation, attachment) request.Data = invocation request.Event = false @@ -341,7 +343,7 @@ func InitTest(t *testing.T) (*Server, *common.URL) { hessian.RegisterPOJO(&User{}) remoting.RegistryCodec("dubbo", &DubboTestCodec{}) - methods, err := common.ServiceMap.Register("", "dubbo", &UserProvider{}) + methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "dubbo", "", "", &UserProvider{}) assert.NoError(t, err) assert.Equal(t, "GetBigPkg,GetUser,GetUser0,GetUser1,GetUser2,GetUser3,GetUser4,GetUser5,GetUser6", methods) @@ -387,14 +389,14 @@ func InitTest(t *testing.T) (*Server, *common.URL) { }}) assert.NoError(t, srvConf.CheckValidity()) - url, err := common.NewURL("dubbo://127.0.0.1:20060/UserProvider?anyhost=true&" + + url, err := common.NewURL("dubbo://127.0.0.1:20060/com.ikurento.user.UserProvider?anyhost=true&" + "application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" + "environment=dev&interface=com.ikurento.user.UserProvider&ip=127.0.0.1&methods=GetUser%2C&" + "module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" + "side=provider&timeout=3000×tamp=1556509797245&bean.name=UserProvider") // init server userProvider := &UserProvider{} - common.ServiceMap.Register("", url.Protocol, userProvider) + common.ServiceMap.Register("", url.Protocol, "", "0.0.1", userProvider) invoker := &proxy_factory.ProxyInvoker{ BaseInvoker: *protocol.NewBaseInvoker(url), }