The Dubbo-go framework provides two built-in protocols: triple and dubbo. In addition, the framework offers various ways to extend protocol access.
In this document, we will introduce the usage of the triple protocol, how to achieve mutual calls with existing dubbo2 systems, and extend support for more protocols. For more principled introductions, please refer to Protocol Specification or related documents in dubbo java .
The triple protocol supports two development modes: protobuf and non-protobuf. We recommend using the protobuf mode for service development.
Currently, most of our examples use this mode, you can refer to Quick Start to learn complete development examples. Here are the basic steps:
If both java and go use the triple+protobuf mode, they can clearly call each other directly.
However, the problem is that many java users use the triple non-protobuf mode, and some older version users use the dubbo tcp protocol. For this business, we can implement protocol mutual calls using the following coding modes of the dubbo-go framework:
Directly use struct to define the service:
Specify the protocol to be published, which can be dubbo, triple or other protocols. Please note that WithInterface("GreetProvider")
must be consistent with the service name on the dubbo-java side (e.g., keep the full path name in java):
Specify the protocol to be called, which can be dubbo, triple, or other protocols. Please note that WithInterface("GreetProvider")
must be consistent with the service name on the dubbo-java side (e.g., keep the full path name in java):
The Dubbo framework supports protocol extensions. Currently, the officially supported protocols in the ecosystem include:
In some scenarios, you can publish services of multiple protocols simultaneously within one application or call services with different protocols simultaneously. Here is a usage example for multi-protocol publishing for reference.