Skip to content
Snippets Groups Projects
Commit 7586d67d authored by vito.he's avatar vito.he
Browse files

Mod: resolve conflict

parents d7b9412a 4f7ef9dd
No related branches found
No related tags found
No related merge requests found
Showing
with 62 additions and 44 deletions
# Go for Apache Dubbo [中文](./README_CN.md) #
# Apache Dubbo-go [中文](./README_CN.md) #
[![Build Status](https://travis-ci.com/apache/dubbo-go.svg?branch=master)](https://travis-ci.com/apache/dubbo-go)
[![Build Status](https://travis-ci.org/apache/dubbo-go.svg?branch=master)](https://travis-ci.org/apache/dubbo-go)
[![codecov](https://codecov.io/gh/apache/dubbo-go/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/dubbo-go)
---
......@@ -16,11 +16,11 @@ Apache License, Version 2.0
## Project Architecture ##
Extension module and layered code design based on dubbo (include protocol layer,registry layer,cluster layer,config layer and so on), Our goal is: you can implement these layered interfaces in a new way, and override the default implementation of dubbo-go[same go-for-apache-dubbo] by calling 'extension.SetXXX' of extension, and complete your special needs without modifying the source code. At the same time, you are welcome to contribute implementation of useful expansion to the community.
Both extension module and layered project architecture is according to Apache Dubbo (including protocol layer, registry layer, cluster layer, config layer and so on), the advantage of this arch is as following: you can implement these layered interfaces in your own way, override the default implementation of dubbo-go by calling 'extension.SetXXX' of extension, complete your special needs without modifying the source code. At the same time, you are welcome to contribute implementation of useful extension to the community.
![frame design](https://raw.githubusercontent.com/wiki/dubbo/dubbo-go/dubbo-go%E4%BB%A3%E7%A0%81%E5%88%86%E5%B1%82%E8%AE%BE%E8%AE%A1.png)
About detail design please refer to [code layered design](https://github.com/apache/dubbo-go/wiki/dubbo-go-V1.0-design)
If you wanna know more about dubbo-go, please visit this reference [Project Architeture design](https://github.com/apache/dubbo-go/wiki/dubbo-go-V1.0-design)
## Feature list ##
......@@ -67,4 +67,3 @@ About dubbo-go benchmarking report, please refer to [dubbo benchmarking report](
## Stargazers
[![Stargazers over time](https://starchart.cc/apache/dubbo-go.svg)](https://starchart.cc/apache/dubbo-go)
# Go for Apache Dubbo [English](./README.md) #
# Apache Dubbo-go [English](./README.md) #
[![Build Status](https://travis-ci.com/apache/dubbo-go.svg?branch=master)](https://travis-ci.com/apache/dubbo-go)
[![Build Status](https://travis-ci.org/apache/dubbo-go.svg?branch=master)](https://travis-ci.org/apache/dubbo-go)
[![codecov](https://codecov.io/gh/apache/dubbo-go/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/dubbo-go)
---
......
......@@ -92,7 +92,7 @@ func (refconfig *ReferenceConfig) Refer() {
refconfig.urls = append(refconfig.urls, &serviceUrl)
} else {
if serviceUrl.Path == "" {
serviceUrl.Path = refconfig.InterfaceName + "/"
serviceUrl.Path = "/" + refconfig.InterfaceName
}
// merge url need to do
newUrl := common.MergeUrl(serviceUrl, url)
......
......@@ -27,11 +27,11 @@ import (
)
import (
"github.com/apache/dubbo-go/common/logger"
hessian "github.com/dubbogo/hessian2"
"github.com/dubbogo/hessian2"
)
import (
"github.com/apache/dubbo-go/common/logger"
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
_ "github.com/apache/dubbo-go/protocol/dubbo"
......@@ -102,6 +102,13 @@ func main() {
println("response result: %v", user)
}
println("\n\n\nstart to test dubbo - getErr")
user = &User{}
err = conMap["com.ikurento.user.UserProvider"].GetRPCService().(*UserProvider).GetErr(context.TODO(), []interface{}{"A003"}, user)
if err != nil {
println("getErr - error: %v", err)
}
println("\n\n\nstart to test dubbo illegal method")
err = conMap["com.ikurento.user.UserProvider"].GetRPCService().(*UserProvider).GetUser1(context.TODO(), []interface{}{"A003"}, user)
if err != nil {
......
......@@ -25,10 +25,13 @@ import (
)
import (
"github.com/apache/dubbo-go/config"
hessian "github.com/dubbogo/hessian2"
)
import (
"github.com/apache/dubbo-go/config"
)
type Gender hessian.JavaEnum
func init() {
......@@ -94,6 +97,7 @@ func (User) JavaClassName() string {
type UserProvider struct {
GetUsers func(req []interface{}) ([]interface{}, error)
GetErr func(ctx context.Context, req []interface{}, rsp *User) error
GetUser func(ctx context.Context, req []interface{}, rsp *User) error
GetUser0 func(id string, name string) (User, error)
GetUser1 func(ctx context.Context, req []interface{}, rsp *User) error
......
......@@ -26,11 +26,11 @@ import (
)
import (
"github.com/apache/dubbo-go/common/logger"
hessian "github.com/dubbogo/hessian2"
)
import (
"github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/config"
_ "github.com/apache/dubbo-go/protocol/dubbo"
_ "github.com/apache/dubbo-go/registry/protocol"
......
......@@ -145,6 +145,10 @@ func (u *UserProvider) GetUser(ctx context.Context, req []interface{}, rsp *User
return err
}
func (u *UserProvider) GetErr(ctx context.Context, req []interface{}, rsp *User) error {
return hessian.NewThrowable("exception")
}
func (u *UserProvider) GetUser0(id string, name string) (User, error) {
var err error
......
......@@ -42,7 +42,7 @@ services:
protocols:
- name: "dubbo"
ip : "127.0.0.1"
# ip : "127.0.0.1"
port : 20000
#- name: "jsonrpc"
# ip: "127.0.0.1"
......
......@@ -42,7 +42,7 @@ services:
protocols:
- name: "dubbo"
ip : "127.0.0.1"
# ip : "127.0.0.1"
port : 20000
#- name: "jsonrpc"
# ip: "127.0.0.1"
......
......@@ -42,7 +42,7 @@ services:
protocols:
- name: "dubbo"
ip : "127.0.0.1"
# ip : "127.0.0.1"
port : 20000
#- name: "jsonrpc"
# ip: "127.0.0.1"
......
......@@ -51,9 +51,18 @@ public class Consumer {
System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
" UserInfo, Id:" + user2.getId() + ", name:" + user2.getName() + ", sex:" + user2.getSex().toString()
+ ", age:" + user2.getAge() + ", time:" + user2.getTime().toString());
User user9 = userProvider.GetUser1("A003");
} catch (Exception e) {
System.out.println("*************exception***********");
e.printStackTrace();
}
try {
userProvider.GetErr("A003");
} catch (Throwable t) {
System.out.println("*************exception***********");
t.printStackTrace();
}
}
private void testGetUsers() throws Exception {
......
......@@ -20,6 +20,8 @@ import java.util.List;
public interface UserProvider {
User GetUser(String userId);
User GetErr(String userId) throws Exception;
User GetUser1(String userId);
List<User> GetUsers(List<String> userIdList);
User GetUser0(String userId, String name);
......
......@@ -14,6 +14,8 @@ public interface UserProvider {
User GetUser0(String userId, String name);
User GetErr(String userId) throws Exception;
Map<String, User> GetUserMap(List<String> userIdList);
User getUser(int usercode);
......
......@@ -35,7 +35,9 @@ public class UserProviderAnotherImpl implements UserProvider {
public User GetUser0(String userId, String name) {
return new User(userId, name, 48);
}
public User GetErr(String userId) throws Exception {
throw new Exception("exception");
}
public List<User> GetUsers(ArrayList<String> userIdList) {
Iterator it = userIdList.iterator();
List<User> userList = new ArrayList<User>();
......
......@@ -32,6 +32,9 @@ public class UserProviderImpl implements UserProvider {
public User GetUser(String userId) {
return new User(userId, "zhangsan", 18);
}
public User GetErr(String userId) throws Exception {
throw new Exception("exception");
}
public User GetUser0(String userId, String name) {
return new User(userId, name, 18);
}
......
......@@ -28,9 +28,6 @@ import (
import (
"github.com/apache/dubbo-go/common/logger"
)
import (
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
_ "github.com/apache/dubbo-go/protocol/jsonrpc"
......
......@@ -17,13 +17,10 @@
package impl
import (
"github.com/apache/dubbo-go/common/logger"
)
import (
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension"
"github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/filter"
"github.com/apache/dubbo-go/protocol"
)
......
module github.com/apache/dubbo-go
require (
github.com/dubbogo/getty v0.0.0-20190523180329-bdf5e640ea53
github.com/dubbogo/hessian2 v0.0.0-20190526221400-d5610bbd0a41
github.com/dubbogo/getty v0.0.0-20190607120257-8b0e100a88af
github.com/dubbogo/hessian2 v0.0.0-20190607144249-afb8cbfad2cb // indirect
github.com/pkg/errors v0.8.1
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec
github.com/stretchr/testify v1.3.0
......
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dubbogo/getty v0.0.0-20190523180329-bdf5e640ea53 h1:bniSNoC4xnAbrx4estwc9F0qkWnh6ZDsAS0y9d7mPos=
github.com/dubbogo/getty v0.0.0-20190523180329-bdf5e640ea53/go.mod h1:cRMSuoCmwc5lULFFnYZTxyCfZhObmRTNbS7XRnPNHSo=
github.com/dubbogo/hessian2 v0.0.0-20190526221400-d5610bbd0a41 h1:lNtW7+aN8oBdCoEuny0rOqOkL5duI4Cu3+G8vqibX48=
github.com/dubbogo/hessian2 v0.0.0-20190526221400-d5610bbd0a41/go.mod h1:XFGDn4oSZX26zkcfhkM/fCJrOqwQJxk/xgWW1KMJBKM=
github.com/dubbogo/getty v0.0.0-20190607120257-8b0e100a88af h1:vvXNXyq5uIlf+KlTduhRKY4hBBBjgCUNreT1yIfKftw=
github.com/dubbogo/getty v0.0.0-20190607120257-8b0e100a88af/go.mod h1:cRMSuoCmwc5lULFFnYZTxyCfZhObmRTNbS7XRnPNHSo=
github.com/dubbogo/hessian2 v0.0.0-20190607144249-afb8cbfad2cb/go.mod h1:XFGDn4oSZX26zkcfhkM/fCJrOqwQJxk/xgWW1KMJBKM=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
......@@ -15,19 +11,12 @@ github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoA
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec h1:6ncX5ko6B9LntYM0YBRXkiSaZMmLYeZ/NWcmeB43mMY=
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec h1:6ncX5ko6B9LntYM0YBRXkiSaZMmLYeZ/NWcmeB43mMY=
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
......@@ -39,10 +28,6 @@ golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53 h1:kcXqo9vE6fsZY5X5Rd7R1l7fT
golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
......@@ -201,6 +201,13 @@ func (c *Client) AsyncCall(addr string, svcUrl common.URL, method string, args i
return perrors.WithStack(c.call(CT_TwoWay, addr, svcUrl, method, args, reply, callback, copts))
}
func (c *Client) GetPendingResponse(seq SequenceType) *PendingResponse {
c.pendingLock.RLock()
defer c.pendingLock.RUnlock()
return c.pendingResponses[SequenceType(seq)]
}
func (c *Client) call(ct CallType, addr string, svcUrl common.URL, method string,
args, reply interface{}, callback AsyncCallback, opts CallOptions) error {
......@@ -257,7 +264,7 @@ func (c *Client) call(ct CallType, addr string, svcUrl common.URL, method string
}
select {
case <-getty.GetTimeWheel().After(opts.ResponseTimeout):
case <-time.After(opts.ResponseTimeout):
err = errClientReadTimeout
c.removePendingResponse(SequenceType(rsp.seq))
case <-rsp.done:
......
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