You can view the complete example source code here.
If you are an old user of Dubbo Java, your Dubbo Java application may not be using Protobuf (defining services directly using Java interfaces). In this case, you need to develop the Dubbo Go-client as follows to call the older version of Dubbo services.
The following solutions support both triple (non-Protobuf) and Dubbo protocols; you only need to adjust the protocol configuration
client.WithClientProtocolTriple()
.
Assuming our current Java service is defined as follows:
We need to write the Go-client as follows to achieve service invocation:
Next, let’s try running the example:
Check if the service is running properly:
In this scenario, it means you need to develop the Go server service entirely from scratch. We recommend directly using Protobuf to develop the Go server service, and the Java client side should also use Protobuf to invoke the new service. For specific usage examples, please refer to the previous documentation.