English | 中文
This example demonstrates how to use dubbo-go with HTTP/3 protocol support via the Triple protocol. It shows how to enable HTTP/3 for high-performance communication between Go and Java services using TLS for secure connections.
Install protoc version3 Please refer to Protocol Buffer Compiler Installation.
Install protoc-gen-go and protoc-gen-triple Install the version of your choice of protoc-gen-go. here use the latest version as example:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31
Install the latest version of protoc-gen-triple:
go install github.com/dubbogo/protoc-gen-go-triple/v3@v3.0.2
Generate stub code
Generate related stub code with protoc-gen-go and protoc-gen-triple:
protoc --go_out=. --go_opt=paths=source_relative --go-triple_out=. --go-triple_opt=paths=source_relative ./proto/greet.proto
Install Maven Maven
cd go-server/cmd go run main.go
Test server works as expected:
curl -k \ --header "Content-Type: application/json" \ --data '{"name": "Dubbo"}' \ https://localhost:20000/greet.GreetService/Greet
cd go-client/cmd go run main.go
Build all Java modules from the root directory:
mvn clean compile
Run the Java server:
On Linux/Mac/Git Bash:
cd java-server mvn exec:java -Dexec.mainClass=org.apache.dubbo.samples.http3.Http3ServerApp
On Windows PowerShell:
cd java-server mvn exec:java "-Dexec.mainClass=org.apache.dubbo.samples.http3.Http3ServerApp"
Or use the provided script (Linux/Mac):
cd java-server ./run.sh
Test server works as expected:
curl -k \ --header "Content-Type: application/json" \ --data '{"name": "Dubbo"}' \ https://localhost:20000/greet.GreetService/Greet
Run the Java client:
On Linux/Mac/Git Bash:
cd java-client mvn exec:java -Dexec.mainClass=org.apache.dubbo.samples.http3.Http3ClientApp
On Windows PowerShell:
cd java-client mvn exec:java "-Dexec.mainClass=org.apache.dubbo.samples.http3.Http3ClientApp"
Or use the provided script (Linux/Mac):
cd java-client ./run.sh
The services are configured with HTTP/3 support. Key configuration parameters:
protocol.triple.http3.enabled=true - Enables HTTP/3 protocolprotocol.triple.http3.negotiation=false - Disables protocol negotiation (forces HTTP/3)The x509 directory contains the following certificate files:
server2_cert.pem - Server certificateserver2_key_pkcs8.pem - Server private key (PKCS8 format)server_ca_cert.pem - CA certificate for verificationDo NOT start Go Server and Java Server at the same time. Both the Go server and Java server listen on the same port: 20000 and expose the same Triple service path: greet.GreetService/Greet