Skip to content
Snippets Groups Projects
Unverified Commit a109609b authored by Xin.Zh's avatar Xin.Zh Committed by GitHub
Browse files

Merge pull request #314 from Patrick0308/add_protocol_warning

When service don't have right protocol config, remind user to check.
parents 4bd28510 d01b5ee8
No related branches found
No related tags found
No related merge requests found
......@@ -117,8 +117,12 @@ func (srvconfig *ServiceConfig) Export() error {
regUrls := loadRegistries(srvconfig.Registry, providerConfig.Registries, common.PROVIDER)
urlMap := srvconfig.getUrlMap()
for _, proto := range loadProtocol(srvconfig.Protocol, providerConfig.Protocols) {
protocolConfigs := loadProtocol(srvconfig.Protocol, providerConfig.Protocols)
if len(protocolConfigs) == 0 {
logger.Warnf("The service %v's '%v' protocols don't has right protocolConfigs ", srvconfig.InterfaceName, srvconfig.Protocol)
return nil
}
for _, proto := range protocolConfigs {
// registry the service reflect
methods, err := common.ServiceMap.Register(proto.Name, srvconfig.rpcService)
if err != nil {
......
......@@ -93,6 +93,30 @@ func doInitProvider() {
},
},
},
"MockServiceNoRightProtocol": {
InterfaceName: "com.MockService",
Protocol: "mock1",
Registry: "shanghai_reg1,shanghai_reg2,hangzhou_reg1,hangzhou_reg2",
Cluster: "failover",
Loadbalance: "random",
Retries: "3",
Group: "huadong_idc",
Version: "1.0.0",
Methods: []*MethodConfig{
{
Name: "GetUser",
Retries: "2",
Loadbalance: "random",
Weight: 200,
},
{
Name: "GetUser1",
Retries: "2",
Loadbalance: "random",
Weight: 200,
},
},
},
},
Protocols: map[string]*ProtocolConfig{
"mock": {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment