项目作者: apache

项目描述 :
Go Implementation For Apache Dubbo
高级语言: Go
项目地址: git://github.com/apache/dubbo-go.git
创建时间: 2018-08-08T05:30:36Z
项目社区:https://github.com/apache/dubbo-go

开源协议:Apache License 2.0

下载


Apache Dubbo for Golang

Build Status
codecov
go.dev reference
Go Report Card
license


Apache Dubbo is an easy-to-use Web and RPC framework that provides multiple
language implementations(Go, Java, Rust, Node.js, Web) for communication, service discovery, traffic management,
observability, security, tools, and best practices for building enterprise-ready microservices.

Dubbo-go is the Go implementation of triple protocol(a fully gRPC compatible and HTTP-friendly protocol) and the various features for building microservice architecture designed by Dubbo.

Visit the official website for more information.

Getting started

You can learn how to develop a dubbo-go RPC application step by step in 5 minutes by following our Quick Start demo.

It’s as simple as the code shown below, you define a service with Protobuf, provide your own service implementation, register it to a server, and start the server.

  1. func (srv *GreetTripleServer) Greet(ctx context.Context, req *greet.GreetRequest) (*greet.GreetResponse, error) {
  2. resp := &greet.GreetResponse{Greeting: req.Name}
  3. return resp, nil
  4. }
  5. func main() {
  6. srv, _ := server.NewServer(
  7. server.WithServerProtocol(
  8. protocol.WithPort(20000),
  9. protocol.WithTriple(),
  10. ),
  11. )
  12. _ := greet.RegisterGreetServiceHandler(srv, &GreetTripleServer{})
  13. if err := srv.Serve(); err != nil {
  14. logger.Error(err)
  15. }
  16. }

After the server is up and running, call your service via cURL:

  1. curl \
  2. --header "Content-Type: application/json" \
  3. --data '{"name": "Dubbo"}' \
  4. http://localhost:20000/greet.GreetService/Greet

Or, you can start a standard dubbo-go client to call the service:

  1. func main() {
  2. cli, _ := client.NewClient(
  3. client.WithClientURL("127.0.0.1:20000"),
  4. )
  5. svc, _ := greet.NewGreetService(cli)
  6. resp, _ := svc.Greet(context.Background(), &greet.GreetRequest{Name: "hello world"})
  7. logger.Infof("Greet response: %s", resp.Greeting)
  8. }

See the samples for detailed information on usage. Next, learn how to deploy, monitor and manage the traffic of your dubbo-go application by visiting the official website.

Features

dubbo-go-architecture

  • RPC Protocols: Triple, gRPC compatible and HTTP-friendly
  • Service Discovery: Nacos, Zookeeper, Etcd, Consul.
  • Load Balance: Adaptive, Random, RoundRobin, LeastActive, ConsistentHash
  • Traffic Management: traffic split, timeout, rate limiting, canary release
  • Configuration: yaml file, dynamic configuration(Nacos, Zookeeper, etc.).
  • Observability: metrics(Prometheus, Grafana) and tracing(Jaeger, Zipkin).
  • HA Strategy: Failover, Failfast, Failsafe/Failback, Available, Broadcast, Forking

Ecosystem

Contributing

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

Contact

Join our discussion group through Ding talk, WeChat, or Discord.

discord https://discord.gg/C5ywvytg
invite.png

User List

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 licensed under the Apache License Version 2.0. See the LICENSE file for details.