English | 中文
Dubbo-go is a high-performance RPC framework for Go language microservices, covering various network protocols: Triple, Dubbo, JSONRPC, gRPC, HTTP, HTTP2, etc. It is the ideal choice for writing microservices in Go.
You can visit the official website for more information.
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.
func (srv *GreetTripleServer) Greet(ctx context.Context, req *greet.GreetRequest) (*greet.GreetResponse, error) {
resp := &greet.GreetResponse{Greeting: req.Name}
return resp, nil
}
func main() {
srv, _ := server.NewServer(
server.WithServerProtocol(
protocol.WithPort(20000),
protocol.WithTriple(),
),
)
_ := greet.RegisterGreetServiceHandler(srv, &GreetTripleServer{})
if err := srv.Serve(); err != nil {
logger.Error(err)
}
}
After the server is up and running, call your service via cURL:
curl \
--header "Content-Type: application/json" \
--data '{"name": "Dubbo"}' \
http://localhost:20000/greet.GreetService/Greet
Or, you can start a standard dubbo-go client to call the service:
func main() {
cli, _ := client.NewClient(
client.WithClientURL("127.0.0.1:20000"),
)
svc, _ := greet.NewGreetService(cli)
resp, _ := svc.Greet(context.Background(), &greet.GreetRequest{Name: "hello world"})
logger.Infof("Greet response: %s", resp.Greeting)
}
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.
- RPC Protocols: Triple, gRPC compatible and HTTP-friendly
- Service Discovery: Nacos, Zookeeper, Etcd, Polaris-mesh, 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
The tools/
directory and the dubbogo/tools
repository provide several utilities to streamline your Dubbo-Go development experience.
A tool that provides JSON Schema for Dubbo-Go configuration files. This simplifies the configuration process by enabling editor assistance.
Features:
- Intelligent Assistance: Enables code completion, hints, and real-time validation for configuration files in supported IDEs.
- Simplified Configuration: Helps you write valid and accurate configurations with ease.
For usage details, see the dubbo-go-schema README.
A comprehensive command-line tool for bootstrapping, managing, and debugging your Dubbo-Go applications.
Features:
- Project Scaffolding: Quickly create new application templates.
- Tool Management: Install and manage essential development tools.
- Interface Debugging: Provides commands to debug your services.
Note: This tool replaces the deprecated dubbogo-cli.
For usage details, see the dubbogo-cli-v2 README.
A protoc
plugin that generates golang code for the Triple protocol from your .proto
(Protocol Buffer) definition files.
Features:
- Code Generation: Generates golang client and server stubs for the Triple protocol.
- Seamless Integration: Works alongside the official
protoc-gen-go
to produce both Protobuf message code (.pb.go
) and Triple interface code (.triple.go
).
Note: This tool replaces the deprecated protoc-gen-dubbo3grpc and deprecated protoc-gen-go-triple.
For usage details, see the protoc-gen-go-triple README.
This is a plugin for dubbo-go developers. A code formatting tool that organizes golang import
blocks according to the Dubbo-Go community style guide.
Features:
- Automatic Formatting: Splits
import
statements into three distinct groups: golang standard library, third-party libraries, and internal project packages. - Code Consistency: Enforces a clean and consistent import style across the codebase.
For usage details, see the imports-formatter README.
- dubbo-go-samples
- dubbo-go-pixiu which acting as a proxy to solve Dubbo multi-language interoperability
- Interoperability with Dubbo Java
- Protoc-gen-go-triple
- Console, under development
Please visit CONTRIBUTING for details on submitting patches and the contribution workflow.
Join our discussion group through Ding talk, WeChat, or Discord.
discord https://discord.gg/C5ywvytg
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.
Apache Dubbo-go software is licensed under the Apache License Version 2.0. See the LICENSE file for details.