Related samples:
Dubbo Go 3.x is centered on the Triple protocol, application-level service discovery, metadata-driven service introspection, and SDK-side governance capabilities. These capabilities are no longer just “new features” from the 3.0 release; they are the normal development model for current Dubbo Go applications.
Triple is the recommended RPC protocol in Dubbo Go 3.x. Its implementation lives mainly under:
protocol/tripleprotocol/triple/triple_protocoltools/protoc-gen-go-tripleThe protocol is based on HTTP/1.1 and HTTP/2 semantics and is compatible with gRPC on the wire. For protobuf-based services, users define .proto files, generate Go code with protoc-gen-go and protoc-gen-go-triple, then register the generated handlers with the Dubbo Go server.
At runtime, the Triple protocol follows the common Dubbo protocol abstraction:
server.Register(...) builds service options and invokers, then protocol Export exposes them;client.Connection, which builds invocations and delegates to protocol Refer invokers;Application-level service discovery is the default discovery model in current Dubbo Go. The provider registers application instances and metadata, while the consumer resolves service-to-application mapping and uses metadata to recover callable service URLs.
Important code entry points include:
registry/options.go: registry type options such as WithRegisterService, WithRegisterInterface, and WithRegisterServiceAndInterface;registry/servicediscovery: application-level registration and subscription;metadata/report and metadata/mapping: metadata report and service-name mapping;options.go: instance-level metadata options such as WithRemoteMetadata and WithMetadataServiceProtocol.There are three registration modes:
| Mode | API | Meaning |
|---|---|---|
service | registry.WithRegisterService() | Register application-level instances. This is the recommended default. |
interface | registry.WithRegisterInterface() | Register interface-level provider URLs. |
all | registry.WithRegisterServiceAndInterface() | Register both models during migration. |
See Application-level Service Discovery for the detailed behavior and defaults.
Application-level discovery needs provider metadata. Dubbo Go supports:
The default metadata type is local. metadata-service-protocol defaults to dubbo, but can be set with dubbo.WithMetadataServiceProtocol(...).
Dubbo Go keeps many governance features in SDK-side extension points:
The one-stop imports package imports common built-in implementations so their init functions register extensions with common/extension.