Giter Club home page Giter Club logo

dubbo-go's Introduction

Apache Dubbo-go

Build Status codecov go.dev reference Go Report Card license


中文 🇨🇳

Apache Dubbo-go, a Dubbo implementation written in Golang, is born to bridge the gap between Java/Dubbo and Go/X. Please visit our Dubbo official website for the quick start and documentation.

RPC invocation

Dubbo-go has supported many RPC protocols, like Triple, Dubbo, JSONRPC, gRPC, HTTP, HTTP2. The Triple, Dubbo and gRPC protocols supported security connections via TLS.

  • Triple is the supported protocol of Dubbo3 ecology, and is gRPC extended protocol based on HTTP2, which is compatible with gRPC service.In other words, on the basis of gRPC's reliable invocation, it adds Dubbo's service governance capability.
  • Dubbo protocol is tradition Dubbo ecology protocol, which is compatible with Dubbo 2.x, and is a good choice for cross-language invocation between GO and Java legacy service.
  • HTTP support: As you can see in the figure above, you can invoke Triple/Dubbo service using HTTP protocol through dubbo-go-pixiu gateway.

Service governance capability

Getting started

Tools

  • imports-formatter formatting dubbo-go project import code block.
  • dubbo-go-cli dubbo-go command line tools, by which you can define your own request pkg and gets rsp struct of your server, test your service as telnet and generate hessian.POJO register method body.
  • dubbo-go-cli-v2 new dubbo-go line tools, you can get services from register center, create a demo , create application templates, one-click installation of protoc-gen-go-triple and imports-formatter tools,and has the same features with dubbo-go-cli.
  • protoc-gen-go-triple tripe protocol pb file generation tool.
  • protoc-gen-dubbo3grpc dubbo3 grpc pb file generation tool.

If you want to know more about dubbogo tools, please visit https://github.com/apache/dubbo-go/blob/master/dubbogo-cli and read its readme carefully.

Intellij plugin

  • Windows: File > Settings > Plugins > Browse repositories... > Search for "Dubbo Go" > Install Plugin
  • MacOS: Preferences > Settings > Plugins > Browse repositories... > Search for "Dubbo Go" > Install Plugin
  • Manually:
    • Download the latest release and install it manually using Preferences > Plugins > Install plugin from disk...
    • From official jetbrains store from download

Features

Feature IDEA GoLand
Hessian2 Generator ✅️ ✅️
New Project/Module ✅️ ✅️

Project/module templates

Project/Module Template Progress
Sample ✅️
Empty Project ✅️
Empty project template middleware
Middleware Module Support
Web Service Gin ✅️
Memory Cache Redis ✅️
Database Gorm ✅️

If you want to know more about the Intellij Plugin for Dubbo-go, you may refer to https://gitee.com/changeden/intellij-plugin-dubbo-go-generator.

Ecosystem

  • Dubbo Ecosystem Entry - A GitHub group dubbo to gather all Dubbo relevant projects not appropriate in apache group yet.
  • dubbo-go-pixiu - A dynamic, high-performance API gateway solution for Dubbo and Http services.
  • dubbo-go-samples - Samples for Apache Dubbo-go.
  • dubbo-getty - A netty like asynchronous network I/O library which supports tcp/udp/websocket network protocol.
  • triple - A golang network package that based on http2, used by Dubbo-go 3.0.
  • dubbo-go-hessian2 - A golang hessian library used by Apache/dubbo-go.
  • gost - A go sdk for Apache Dubbo-go.

Contributing

Please visit CONTRIBUTING for details on submitting patches and the contribution workflow.

Reporting bugs

Please use the bug report template to report bugs, use the enhancement template to provide suggestions for improvement.

Contact

If you are using apache/dubbo-go and think that it helps you or want to contribute code for Dubbo-go, please add your company to the user list to let us know your needs.

See more user cases

License

Apache Dubbo-go software is licenced under the Apache License Version 2.0. See the LICENSE file for details.

dubbo-go's People

Contributors

alexstocks avatar aliiohs avatar beiwei30 avatar chickenlj avatar cityiron avatar cjphaha avatar codingsinger avatar cvictory avatar dependabot[bot] avatar fangyincheng avatar finalt avatar flycash avatar hxmhlt avatar justxuewei avatar laurencelizhixin avatar lzp0412 avatar pantianying avatar patrick0308 avatar pherzheyu avatar sdttttt avatar sxllwx avatar watermelo avatar wenxuwan avatar wongoo avatar xujianhai666 avatar ygrylls avatar zhaoyunxing92 avatar zonghaishang avatar zouyx avatar ztelur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dubbo-go's Issues

当java端的Date是null,go端decode将会报错,如果使用*time.Time可ui接收null,但是将无法接收正常Date

What happened:
当java端的Date是null,go端decode将会报错,如果使用*time.Time可ui接收null,但是将无法接收正常Date
What you expected to happen:
抛出的异常:
ERROR [email protected]/session.go:558 [session.handlePackage] error:decObject illegal object type tag:74 github.com/dubbogo/hessian2.(*Decoder).decObject
How to reproduce it (as minimally and precisely as possible):
go 作为 client 端,java作为server端,使用dubbogo框架进行调用
struct_example

Anything else we need to know?:

Improve README to start go-client example

When compiling the source code, remind the user to be careful with the architecture.

cd dubbo/go-client
#linux, mac windows represent the os
#release, dev and test represent the environment
sh ./assembly/linux/release.sh

For example:

sh ./asssembly/$ARCH/$ENV.sh 

where $ARCH = [linux | mac | windows] and $ENV = [ release | dev | test]

Example: sh ./assembly/linux/release.sh

TODO list

No Task owner Status
1 cluster strategy: Failfast/Failsafe/Failback @xujianhai666 done
2 loadbalance: RoundRobin/LeastActive 诣极 done
3 filter :AccessLogFilter @flycash done
4 routing rule @aliiohs doing
5 default monitor(prometheus) 晓冬 doing
6 trace(jeager impl) 晓冬
7 asynchronous call @zouyx done
8 callback parameter
9 delay pubilsh deprecated
10 connections & concurrency control
11 lazy connection @CodingSinger
12 sticky connection @CodingSinger
13 Token Authorization @xujianhai666 done
14 Service-Downgrade @YGrylls done
15 graceful exit @flycash done
16 user guide outline
17 generic invoke @pantianying done
18 TPS limit @flycash done
19 loadbalance: ConsistentHash @imxyb
20 support java generics
21 appollo config center @xujianhai666 done
22 http restful @yiduwangkai
23 thrift supportl @aliiohs
24 etcd/consul config center impl @xujianhai666
25 nacos config center impl @amudong done
26 setLoggerLevel function @fangyincheng doing
27 k8s as registry @yiduwangkai doing
28 grpc @xujianhai666 doing
29 protocol buffer @skyitachi doing
30 Adapt to Dubbo admin
31 generic implement @Patrick0308 done

Benchmark test problem

What happened:

There are these problems, when high concurrency and continuous stress testing:

  • 'read tcp io timeout' is frequent
  • High CPU and memory footprint

What you expected to happen:

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

Anything else we need to know?:

Dynamic create go-client,without code like「javabean config code」

What would you like to be added:

在dubbo协议下,go-client能通过传入配置参数的形式实例化一个dubbo客户端。

Why is this needed:
当go-client调用dubbo接口时,必须代码实现一个javabean的描述。这个使业务端如果要动态调用十分不方便。
比如服务端新增了一个接口,客户单必须更改代码,不能通过更改配置实现。
比如go服务要做一个网关形式的服务,无法完成一些透传接口的工作
比如接口过多,go客户端将会需要很多代码描述。

go-server启动后不能访问

go-server启动service后,启动go-client。但是client报错
panic: Failed to invoke the method GetUser in the service

(2/1)from the registry zookeeper://:@127.0.0.1:2181?group=&registry=zookeeper&registry.role=0&registry.timeout=3s on the consumer 192.168.99.1 using the dubbo version 2.5.3. Last error is can not find go type name in registry.

在zookeeper里有这个service

[zk: localhost:2181(CONNECTED) 76] ls /dubbo/com.lagou.chenlei.demo.main.UserService/providers
[dubbo://10.71.8.99:12345/com.xxx.demo.main.UserService?anyhost=true&app.version=1.0&application=BDTService&category=providers&cluster=failover&dubbo=dubbo-provider-golang-2.5.3&environment=dev&group=&interface=com.xxx.demo.main.UserService&ip=192.168.99.1&loadbalance=random&methods.GetUser.loadbalance=&methods.GetUser.retries=0&methods.GetUser.weight=0&module=dubbogo+user-info+server&name=BDTService&organization=ikurento.com&owner=ZX&pid=59371&retries=0&side=provider&timestamp=1558520537&version=&warmup=100]

多个dubbo provider场景,如果某一个provider网络不可达,不会进行自动切换

What happened:
当多个dubbo provider的场景下,若有某一个网络不可达,同时客户端进行尝试连接,返回
net.DialTimeout(addr xxx:, timeout:3e+09) = error:dial tcp xxx: i/o timeout,并且不会进行自动的轮询切换
What you expected to happen:
当多个dubbo provider的场景下,consumer发起请求时,若有部分provider不可达(无论是网络原因还是provider自身的原因),consumer应自动切换,并尝试连接别的provider
How to reproduce it (as minimally and precisely as possible):

  1. 提供多个dubbo provider场景
  2. 可以禁用其中的某一个(达到不可达的目的)
  3. consumer发起请求,当请求到达被禁用的provider节点的时候,一直显示i/o timeout,并且不会进行自动的轮询切换
    dubbo providers :
    dubbo_multi_providers
    client timeout:
    client_timeout

Anything else we need to know?:

add failfastCluster

What would you like to be added:
add failfastCluster

Why is this needed:
be consistent with java version

log test fail

What happened:

I run the unit test of logger_test.go on win10, and result is below:

test_log_error

What you expected to happen:

Unit test pass.

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

Click run buttom:

run

Anything else we need to know?:

  • platform: win10

java与go接入问题

java与go接入问题:
现在我们与go对接,有一个问题,java的序列化go不能用,如果接入dubbo-go客户端,这个问题还要考虑么
我们现在用的是2.6.2的默认的序列化
dubbo://,hessian2
谢谢

Ftr:registry interface should define function "unregister"

java registry unregister部分的源码,unregister这个的用途是:
1.provider在启动时也会启动registry的监听,当发现registry上注册的service内容跟本地刚启动时注册的service不一致时,就会刷新registry。
2.qos,允许运维人员对服务进行动态上下限。http://dubbo.apache.org/zh-cn/blog/introduction-to-dubbo-qos.html

1和2需求,暂时非紧急需求,先记个issue后面再完善。

Update README

Go for Apache Dubbo can be changed to dubbo-go now~

Could not start java server example on Java 11

What happened:

OpenJDK 64-Bit Server VM warning: Ignoring option PermSize; support was removed in 8.0
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Unrecognized VM option 'UseCMSCompactAtFullCollection'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

What you expected to happen:

Server can start

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

cd dubbo/java-server/target
tar -zxvf user-info-server-0.2.0-assembly.tar.gz
cd ./user-info-server-0.2.0
sh ./bin/server.sh start

Anything else we need to know?:

The option UseCMSCompactAtFullCollection is no longer supported in Java 11. It is better to remove it.

Why define method name "JavaClassName" as hessian pojo type interface method?

What happened:
I use go client to call go server. Why I have to implement the pojo method named "JavaClassName"?

What you expected to happen:
Rename name .Or I do not need to register pojo when go client calling go server.
How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

go-client can not invoke java-server in right way

1.go-client can not parse POJO in right way when java-server provide "Byte" as return
panic: Failed to invoke the method getTuple in the service com.*******.TupleProvider. Tried 3 times of the providers [dubbo://:@192.168.97.78:13675/com.*******.TupleProvider?group=&version= dubbo://:@192.168.97.78:13675/com.*******.TupleProvider?group=&version= dubbo://:@192.168.97.78:13675/com.*******.TupleProvider?group=&version=] (3/1)from the registry zookeeper://:@192.168.11.29:2181?group=&registry=zookeeper&registry.role=0&registry.timeout=3s on the consumer 192.168.97.78 using the dubbo version 2.6.0. Last error is unknown struct member type: int8.
2.go-client can not invoke nonparameter method provides by java-server
panic: runtime error: index out of range

public class Tuple implements Serializable {
    private static final long serialVersionUID = -1L;

    Integer Integer;
    Byte Byte;
    Short Short;
    Long Long;
    int i;
    byte b;
    short s;
    long l;
}

public interface TupleProvider {

    Tuple getTuple(Integer i);

    Tuple getTheTuple();
}


@Component
public class TupleProviderImpl implements TupleProvider {

    @Override
    public Tuple getTuple(Integer i) {
        return getTheTuple();
    }

    @Override
    public Tuple getTheTuple() {
        Tuple result = new Tuple();
        result.setB((byte) 1);
        result.setByte(Byte.valueOf("1"));
        result.setI(1);
        result.setInteger(Integer.valueOf("1"));
        result.setL(1L);
        result.setLong(Long.valueOf("1"));
        result.setS((short) 1);
        result.setShort(Short.valueOf("1"));
        return result;

    }
}

type Tuple struct {
	Byte    int8
	Short   int16
	Integer int32
	Long    int64
	B       int8
	S       int16
	I       int32
	L       int64
}

func (t Tuple) JavaClassName() string {
	return "com.***.Tuple"
}

type TupleProvider struct {
	GetTuple func(i int32) (tuple *Tuple, err error) `dubbo:"getTuple"`
	GetTheTuple func() (tuple *Tuple, err error) `dubbo:"getTheTuple"`
}

func (provider *TupleProvider) Service() string {
	return "com.***.TupleProvider"
}

func (provider *TupleProvider) Version() string {
	return ""
}

cannot start

github.com/dubbo/go-for-apache-dubbo/dubbo/client.go:237:21: undefined: hessian.Heartbeat

when set p2p mode without registry , provider side will not be connected.

What happened:
when set p2p module without registry , provider side will not be connected.
What you expected to happen:
consumer can invoke the service in provider by p2p.
How to reproduce it (as minimally and precisely as possible):
consumer & provider without registry configuration and consumer set "url" as provider's address.
Anything else we need to know?:

FAQ

1. 环境变量问题

  • 如果没有配置环境变量,可以将os.Getenv去掉,CONF_CONSUMER_FILE_PATH直接给配置文件地址
  • confConFile = os.Getenv(constant.CONF_CONSUMER_FILE_PATH)
  • confProFile = os.Getenv(constant.CONF_PROVIDER_FILE_PATH)
    改为
  • confConFile = constant.CONF_CONSUMER_FILE_PATH
  • confProFile = constant.CONF_PROVIDER_FILE_PATH

2. 在IDE(vscode or Goland)项目运行时报未声明

  • 选中client.go user.go version.go同时运行
    待更新中...

java server example build failure on Java 11

What happened:

Maven build failure on Java 11.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.257 s
[INFO] Finished at: 2019-06-06T14:56:32+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project user-info-server: Compilation failure: Compilation failure:
[ERROR] Source option 5 is no longer supported. Use 6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

What you expected to happen:

Build pass

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

cd example/dubbo/java-server and run sh build.sh

Anything else we need to know?:

Proposed fix

diff --git a/examples/dubbo/java-server/pom.xml b/examples/dubbo/java-server/pom.xml
index 9751578..da9c8b8 100644
--- a/examples/dubbo/java-server/pom.xml
+++ b/examples/dubbo/java-server/pom.xml
@@ -11,9 +11,12 @@
     <description>The demo provider module of dubbo project</description>
     <properties>
         <skip_maven_deploy>false</skip_maven_deploy>
-
         <dubbo-version>2.6.5</dubbo-version>
         <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+        <maven_compiler_version>3.6.0</maven_compiler_version>
+        <java_source_version>1.6</java_source_version>
+        <java_target_version>1.6</java_target_version>
+        <file_encoding>UTF-8</file_encoding>
     </properties>

     <dependencyManagement>
@@ -172,6 +175,19 @@
                     </execution>
                 </executions>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>${maven_compiler_version}</version>
+                <configuration>
+                    <compilerArgument>-proc:none</compilerArgument>
+                    <fork>true</fork>
+                    <source>${java_source_version}</source>
+                    <target>${java_target_version}</target>
+                    <encoding>${file_encoding}</encoding>
+                </configuration>
+            </plugin>
         </plugins>
     </build>

jsonrpc server feature

jsonrpc 2.0 server feature list:
service registration based on zookeeper;
using jsonrpc 2.0 protocol;
using http transport;

provider.go line 260-265有什么用途

如题,实际测试后发现在server运行过程中,将zookeeper停掉后再启动,server因为这段逻辑的存在,会将原来的service如com.ikurento.user.UserProvider重新注册为com.ikurento.user.UserProvider1

Bug: java-client can not get error message when go-server return error

My code is as follows

go-server
image

java-client
image

The problem is that exception java catched is not contain the go error message which should be ‘invalid params: uid, name, cert could not be empty’.

In fact, java-client always catch as follows:

Failed to invoke the method Init in the service com.xxx.service.go.base.certify.api.CertifyService. Tried 1 times of the providers [10.71.8.70:20001] (1/1) from the registry 10.71.8.70:2181 on the consumer 10.71.8.70 using the dubbo version 2.6.3. Last error is: Failed to invoke remote method: Init, provider: dubbo://10.71.8.70:20001/com.xxx.service.go.base.certify.api.CertifyService?anyhost=true&app.version=1.0&application=consumer-of-certify-app&category=providers&check=false&cluster=failover&dubbo=dubbo-provider-golang-2.6.0&environment=dev&group=&interface=com.xxx.service.go.base.certify.api.CertifyService&ip=192.168.99.1&loadbalance=random&methods=Init&methods.Init.loadbalance=random&methods.Init.retries=3&methods.Init.weight=0&module=dubbogo+certify+server&name=CertifyService&organization=test.com&owner=raychen&pid=71023&register.ip=10.71.8.70&remote.timestamp=1559621785&retries=0&service.filter=echo&side=consumer&timestamp=1559622450690&version=&warmup=100, cause: 0

Ftr: support java generic

go-for-apache-dubbo hessian2 doesn't support generics yet,like Response<T>

test case:

  • java
com.ikurento.user.Response<T> 

Responst<Integer> com.ikurento.user.UserProvider.sum(int a, int b)
  • go
type Response struct {
	OK int32
	ERR int32
	Status int32
	Err string
        // How do I define this field
	Data interface{}
}


func (Response) JavaClassName() string {
	return "com.ikurento.user.Response"
}

func (r Response) String() string {
	return fmt.Sprintf(
		"Response{OK:%d, ERR:%d, Status:%d, Err:%s, Data:%s}",
		r.OK, r.ERR,r.Status,r.Err,r.Data,
	)
}

hessian.RegisterPOJO(&Response{})

response := &Response{}
err := conMap["com.ikurento.user.UserProvider"].GetRPCService().(*UserProvider).Sum(context.TODO(), []interface{}{1, 2}, response)

dubbo-java支持多注册中心

每个注册中心url都会在java中生成一个registry对象(即使是同一种注册中心类型如zookeeper,dubbo-java也会认为是多注册中心的情况)。所以java invoker的调用链为: RegistryAwareClusterInvoker(StaticDirectory) -> FailoverClusterInvoker(RegistryDirectory, will execute route) -> Invoker,需要先选取注册中心获取对应的缓存url list再去调用。
go版本目前未实现多种类注册中心,而对于同一种注册中心如zookeeper,在zk-client层就已经处理掉了,注册中心面向dubbo只有一个client实例。

i hope dubbo.comsumer.xml & dubbo.provider.xml read from remote configCenter,not only local

func consumerInit(confConFile string) error {
if confConFile == "" {
return perrors.Errorf("application configure(consumer) file name is nil")
}
if path.Ext(confConFile) != ".yml" {
return perrors.Errorf("application configure file name{%v} suffix must be .yml", confConFile)
}
// when configCenter is apollo,configfile is remote config,can't read config.So hope provider read config through http.
confFileStream, err := ioutil.ReadFile(confConFile)
if err != nil {
return perrors.Errorf("ioutil.ReadFile(file:%s) = error:%v", confConFile, perrors.WithStack(err))
}
consumerConfig = &ConsumerConfig{}
err = yaml.Unmarshal(confFileStream, consumerConfig)
if err != nil {
return perrors.Errorf("yaml.Unmarshal() = error:%v", perrors.WithStack(err))
}
xxx
}

我们的服务运行在docker里,配置中心是携程的apollo。配置内容在配置中心上,通过配置中心来区分环境的。这里初始化直接读取本地的文件,实际上用不了。建议能够初始化时读取远程配置中心的配置,例如:apollo,etcd。

Feature: dubbogo 中如何使用 bigdecimal [ok for usage]

项目对接时将bigdecimal改为string成功接收(证明不是连接问题)

  1. 改回bigdecimal后使用golang中的float64测试报错

  2. 然后再此时下方包中的Decimal,已经不能接收BigDecimal类型
    import "github.com/shopspring/decimal"

  3. 尝试使用golang中的big类型同样失败

BigDecimal在Java中是常用的精确计算包装类,实际业务不可能改为浮点类型,所以该问题依旧是需要解决的问题

Imp: service provider improvement todo list

service provider improvement todo list:

  • allow service provider return nil response
func (p *Provider) GetUser(userID int64) (*User, error) {
	...
	return nil, nil
}
  • allow service provider none response
func (p *Provider) SetUserInfo(userInfo *User) error {
	...
	return nil
}
  • allow service provider none request
func (p *Provider) TakeUser() (*User, error) {
	...
	return &User{}
}
  • host bind ip auto detect when not being configured
  • provider config map abstractions
conMap, _ := config.Load()
res, err := conMap["com.ikurento.user.UserProvider"].GetRPCService("com.ikurento.user.UserProvider").(*UserProvider).Echo(context.TODO(), "OK")
if err != nil {
	panic(err)
}

to

providerInstance, _ := config.Build()
res, err := providerInstance.GetRPCService("com.ikurento.user.UserProvider").(*UserProvider).Echo(context.TODO(), "OK")
if err != nil {
	panic(err)
}

Who's Using Dubbo-go? 谁在使用 Dubbo-go?

Welcome to use dubbo-go. To know who is using it, pls append your org info as follow,

  • Organization:Alibaba (Required)
  • Location: Hangzhou, Zhejiang, China(Required)
  • Contact: [email protected] (Optional)
  • Purpose:used as our fundamental network transport lib (Required)
  • Registry: zookeeper(Required)
  • Version: 1.5.5(Required)
  • Com/Org Logo:(Optional)
    Thanks again for your participation!

欢迎使用dubbogo,首先感谢你的使用,其次您可以参考下面的样例来提供您的信息以收集下使用场景:

* 组织:阿里巴巴(Required)
* 地点:**杭州(Required)
* 联系方式:[email protected](Optional)
* 场景:阿里内部服务化改造(Required)
* 注册中心: zookeeper(Optional)
* 版本: 1.5.5(Optional)
* 公司图标:(Optional)

再次感谢你的参与!!!

在使用go mod 情况下 go get dubbo-go 1.0.0 有源码使用了旧包地址不能正常依赖

What happened:
go get dubbo-go 1.0.0 有源码使用了旧包地址不能正常依赖

go get -u github.com/apache/dubbo-go
go: github.com/apache/[email protected]: parsing go.mod: unexpected module path "github.com/dubbo/go-for-apache-dubbo"
go get: error loading module requirements

What you expected to happen:

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

Anything else we need to know?:

graceful exit

func initSignal() {
signals := make(chan os.Signal, 1)
// It is not possible to block SIGKILL or syscall.SIGSTOP
signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
sig := <-signals
logger.Infof("get signal %s", sig.String())
switch sig {
case syscall.SIGHUP:
// reload()
default:
go time.AfterFunc(time.Duration(float64(survivalTimeout)*float64(time.Second)), func() {
logger.Warnf("app exit now by force...")
os.Exit(1)
})
// 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
fmt.Println("provider app exit now...")
return
}
}
}

What would you like to be added:

The code above may be placed in dubbo-go's code better than in user's code.

Why is this needed:

Does code above mean graceful exit? If this code is used frequently, we can move it to the dubbo-go's code so that users need not write it every time.

Ftr: support provider method name customize

Consider one of following implementation, or all:

add struct field named method name and DubboName suffix

type UserProvider struct {
	GetUserDubboName struct{} `dubbo:"getUser"`

	user map[string]User
}

func (u *UserProvider) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
	...
}

func (u *UserProvider) Service() string {
	return "com.my.UserProvider"
}

func (u *UserProvider) Version() string {
	return ""
}

add struct MethodAlias Method return map[string]string (init needed)

type UserProvider struct {
	user map[string]User
}

func (u *UserProvider) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
	...
}

func (u *UserProvider) Service() string {
	return "com.my.UserProvider"
}

func (u *UserProvider) Version() string {
	return ""
}

func (u UserProvider) MethodAlias() map[string]string {
	return map[string]string{"GetUser":"getUser"}
}

go hessian client/server

go hessian client/server feature list:
service registration based on zookeeper;
using hessian protocol;
using tcp transport;

Ftr: dubbo-java支持客户端服务调用的动态代理

通过proxyFactory动态代理机制会返回客户端调用服务的invoker对象,开发者在使用时只需要正常调用接口方法。
golang没有动态代理机制,需要考虑一种方式来做到最小化调用。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.