Skip to content

Commit

Permalink
Merge pull request #1 from apache/3.0
Browse files Browse the repository at this point in the history
3.0
  • Loading branch information
ztelur authored May 1, 2021
2 parents 95c99f0 + ddc39a3 commit b048366
Show file tree
Hide file tree
Showing 120 changed files with 2,628 additions and 2,360 deletions.
10 changes: 5 additions & 5 deletions .asf.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
notifications:
commits: [email protected]
issues: [email protected]
pullrequests: [email protected]
jira_options: link label link label
notifications:
commits: [email protected]
issues: [email protected]
pullrequests: [email protected]
jira_options: link label link label
38 changes: 19 additions & 19 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
name: Bug Report
about: Report a bug
labels: kind/bug

---

<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
-->


**What happened**:

**What you expected to happen**:

**How to reproduce it (as minimally and precisely as possible)**:

**Anything else we need to know?**:
---
name: Bug Report
about: Report a bug
labels: kind/bug

---

<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
-->


**What happened**:

**What you expected to happen**:

**How to reproduce it (as minimally and precisely as possible)**:

**Anything else we need to know?**:
20 changes: 10 additions & 10 deletions .github/ISSUE_TEMPLATE/enhancement.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
name: Enhancement Request
about: Suggest an enhancement
labels: kind/feature

---
<!-- Please only use this template for submitting enhancement requests -->

**What would you like to be added**:

---
name: Enhancement Request
about: Suggest an enhancement
labels: kind/feature

---
<!-- Please only use this template for submitting enhancement requests -->

**What would you like to be added**:

**Why is this needed**:
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/[email protected].4
uses: actions/[email protected].5
with:
# Cache
path: ~/go/pkg/mod
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,22 @@ If u want to communicate with our community, pls scan the following dubbobo Ding
</table>
</div>

If u want to visit the wechat group, pls add my wechat AlexanderStocks.
If u want to visit the wechat group, pls add my wechat AlexanderStocks or scan the following wechat picture.

<div>
<table>
<tbody>
<tr></tr>
<tr>
<td align="center" valign="middle">
<img width="80px" height="115px" src="./doc/pic/misc/dubbogo-wechat.png">
</a>
</td>
</tr>
<tr></tr>
</tbody>
</table>
</div>

We welcome the friends who can give us constructing suggestions instead of known-nothing.

Expand Down Expand Up @@ -288,6 +303,11 @@ If you are using [apache/dubbo-go](https://github.com/apache/dubbo-go) and think
<img width="222px" src="https://mosn.io/images/community/duodian.png">
</a>
</td>
<td align="center" valign="middle">
<a href="http://www.ruubypay.com" target="_blank">
<img width="222px" src="http://website.ruubypay.com/wifi/image/line5.png">
</a>
</td>
</tr>
<tr></tr>
</tbody>
Expand Down
7 changes: 6 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ make test
</table>
</div>

dubbogo 社区已经开通微信公众号 "dubbogo大区",可在微信搜索 "dubbogo大区" 或者扫描如下二维码关注,可通过公众号私信留言加入 dubbogo 微信社区。
dubbogo 社区已经开通微信公众号,可在微信搜索 "dubbogo示土区" 或者扫描如下二维码关注,可通过公众号私信留言加入 dubbogo 微信社区。

<div>
<table>
Expand Down Expand Up @@ -301,6 +301,11 @@ dubbogo 社区已经开通微信公众号 "dubbogo大区",可在微信搜索 "
<img width="222px" src="https://mosn.io/images/community/duodian.png">
</a>
</td>
<td align="center" valign="middle">
<a href="http://www.ruubypay.com" target="_blank">
<img width="222px" src="http://website.ruubypay.com/wifi/image/line5.png">
</a>
</td>
</tr>
<tr></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion cluster/cluster_impl/failback_cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (invoker *failbackClusterInvoker) Invoke(ctx context.Context, invocation pr
logger.Errorf("Failback to invoke the method %v in the service %v, wait for retry in background. Ignored exception: %v.\n",
methodName, url.Service(), result.Error().Error())
// ignore
return &protocol.RPCResult{}
return &protocol.RPCResult{Err: result.Error()}
}
return result
}
Expand Down
8 changes: 8 additions & 0 deletions common/constant/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,11 @@ const (
DEFAULT_LOG_CONF_FILE_PATH = "../profiles/dev/log.yml"
DEFAULT_ROUTER_CONF_FILE_PATH = "../profiles/dev/router.yml"
)

// default config value
const (
DEFAULT_REGISTRY_ZK_ID = "demoZK"
DEFAULT_REGISTRY_ZK_PROTOCOL = ZOOKEEPER_KEY
DEFAULT_REGISTRY_ZK_TIMEOUT = "3s"
DEFAULT_REGISTRY_ZK_ADDRESS = "127.0.0.1:2181"
)
3 changes: 2 additions & 1 deletion common/constant/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,12 @@ const (
const (
SUBSCRIBED_SERVICE_NAMES_KEY = "subscribed-services"
PROVIDER_BY = "provided-by"
EXPORTED_SERVICES_REVISION_PROPERTY_NAME = "dubbo.exported-services.revision"
EXPORTED_SERVICES_REVISION_PROPERTY_NAME = "dubbo.metadata.revision"
SUBSCRIBED_SERVICES_REVISION_PROPERTY_NAME = "dubbo.subscribed-services.revision"
SERVICE_INSTANCE_SELECTOR = "service-instance-selector"
METADATA_STORAGE_TYPE_PROPERTY_NAME = "dubbo.metadata.storage-type"
DEFAULT_METADATA_STORAGE_TYPE = "local"
REMOTE_METADATA_STORAGE_TYPE = "remote"
SERVICE_INSTANCE_ENDPOINTS = "dubbo.endpoints"
METADATA_SERVICE_PREFIX = "dubbo.metadata-service."
METADATA_SERVICE_URL_PARAMS_PROPERTY_NAME = METADATA_SERVICE_PREFIX + "url-params"
Expand Down
50 changes: 50 additions & 0 deletions common/extension/metadata_remote.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package extension

import (
"fmt"
)

import (
perrors "github.com/pkg/errors"
)

import (
"github.com/apache/dubbo-go/metadata/service/remote"
)

type remoteMetadataServiceCreator func() (remote.RemoteMetadataService, error)

var (
creator remoteMetadataServiceCreator
)

// SetRemoteMetadataService will store the remote metadata service
func SetRemoteMetadataService(creatorFunc remoteMetadataServiceCreator) {
creator = creatorFunc
}

// GetRemoteMetadataServiceFactory will create a MetadataService instance
func GetRemoteMetadataService() (remote.RemoteMetadataService, error) {
if creator != nil {
return creator()
}
return nil, perrors.New(fmt.Sprintf("could not find the metadata service creator for metadataType: remote, please check whether you have imported relative packages, \n" +
"remote - github.com/apache/dubbo-go/metadata/remote/impl"))
}
43 changes: 15 additions & 28 deletions common/extension/metadata_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,29 @@ import (
)

import (
"github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/metadata/service"
)

type localMetadataServiceCreator func() (service.MetadataService, error)

var (
// there will be two types: local or remote
metadataServiceInsMap = make(map[string]func() (service.MetadataService, error), 2)
// remoteMetadataService
remoteMetadataService service.MetadataService
localMetadataServiceInsMap = make(map[string]localMetadataServiceCreator, 2)
)

// SetMetadataService will store the msType => creator pair
func SetMetadataService(msType string, creator func() (service.MetadataService, error)) {
metadataServiceInsMap[msType] = creator
}

// GetMetadataService will create a MetadataService instance
func GetMetadataService(msType string) (service.MetadataService, error) {
if creator, ok := metadataServiceInsMap[msType]; ok {
return creator()
}
return nil, perrors.New(fmt.Sprintf("could not find the metadata service creator for metadataType: %s, please check whether you have imported relative packages, \n"+
"local - github.com/apache/dubbo-go/metadata/service/inmemory, \n"+
"remote - github.com/apache/dubbo-go/metadata/service/remote", msType))
// SetLocalMetadataService will store the msType => creator pair
func SetLocalMetadataService(key string, creator localMetadataServiceCreator) {
localMetadataServiceInsMap[key] = creator
}

// GetRemoteMetadataService will get a RemoteMetadataService instance
func GetRemoteMetadataService() (service.MetadataService, error) {
if remoteMetadataService != nil {
return remoteMetadataService, nil
// GetMetadataService will create a inmemory MetadataService instance
func GetLocalMetadataService(key string) (service.MetadataService, error) {
if key == "" {
key = constant.DEFAULT_KEY
}
if creator, ok := metadataServiceInsMap["remote"]; ok {
var err error
remoteMetadataService, err = creator()
return remoteMetadataService, err
if creator, ok := localMetadataServiceInsMap[key]; ok {
return creator()
}
logger.Warn("could not find the metadata service creator for metadataType: remote")
return nil, perrors.New(fmt.Sprintf("could not find the metadata service creator for metadataType: remote"))
return nil, perrors.New(fmt.Sprintf("could not find the metadata service creator for metadataType: local, please check whether you have imported relative packages, \n" +
"local - github.com/apache/dubbo-go/metadata/service/inmemory, "))
}
7 changes: 5 additions & 2 deletions common/extension/metadata_service_proxy_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
)

import (
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/metadata/service"
)

Expand All @@ -37,10 +38,12 @@ func SetMetadataServiceProxyFactory(name string, creator MetadataServiceProxyFac
// GetMetadataServiceProxyFactory will create an instance.
// it will panic if the factory with name not found
func GetMetadataServiceProxyFactory(name string) service.MetadataServiceProxyFactory {
if name == "" {
name = constant.DEFAULT_KEY
}
if f, ok := metadataServiceProxyFactoryMap[name]; ok {
return f()
}
panic(fmt.Sprintf("could not find the metadata service factory creator for name: %s, please check whether you have imported relative packages, \n"+
"local - github.com/apache/dubbo-go/metadata/service/inmemory, \n"+
"remote - github.com/apache/dubbo-go/metadata/service/remote", name))
"local - github.com/apache/dubbo-go/metadata/service/inmemory, \n", name))
}
Loading

0 comments on commit b048366

Please sign in to comment.