tree: f4a62b3eec1f1efd3e528a0544eb1c3304c98eb5 [path history] [tgz]
  1. build/
  2. src/
  3. pom.xml
  4. README.md
1-basic/dubbo-samples-api-idl/README.md

Dubbo Triple With Protobuf

This example shows the basic usage of Triple protocol with a typical request-response model demo that uses IDL as the method of defining Dubbo service.

As described in the Triple protocol documentation, Dubbo triple protocol is a better gRPC implementation which can be accessed by cURL and web browsers directly.

More usages of Triple protocol can be found here:

Run The Demo

Detailed explanation of this demo can be found here.

Make sure you are in dubbo-samples-triple-unary before running the following commands.

mvn clean compile #Compile and generate code

Start server

$ mvn compile exec:java -Dexec.mainClass="org.apache.dubbo.samples.tri.unary.TriUnaryServer"

Start Client

There are two ways to test the server works as expected:

  • Standard HTTP tools like cURL.
  • Dubbo sdk client.

cURL

curl \
    --header "Content-Type: application/json" \
    --data '{"name": "Dubbo"}' \
    http://localhost:50052/org.apache.dubbo.samples.tri.unary.Greeter/greet/

Start client

$ mvn compile exec:java -Dexec.mainClass="org.apache.dubbo.samples.tri.unary.TriUnaryClient"