grpc-java/examples/example-dualstack
Eric Anderson 75012a5be2
examples: Upgrade Maven plugin versions
Upgrade Maven to 3.8.8, the oldest supported version, as the plugins required a
newer version.
2024-08-13 16:43:44 -07:00
..
src/main Dualstack example (#11451) 2024-08-08 15:59:57 -07:00
README.md Dualstack example (#11451) 2024-08-08 15:59:57 -07:00
build.gradle Dualstack example (#11451) 2024-08-08 15:59:57 -07:00
pom.xml examples: Upgrade Maven plugin versions 2024-08-13 16:43:44 -07:00
settings.gradle Dualstack example (#11451) 2024-08-08 15:59:57 -07:00

README.md

gRPC Dualstack Example

The dualstack example uses a custom name resolver that provides both IPv4 and IPv6 localhost endpoints for each of 3 server instances. The client will first use the default name resolver and load balancers which will only connect tot he first server. It will then use the custom name resolver with round robin to connect to each of the servers in turn. The 3 instances of the server will bind respectively to: both IPv4 and IPv6, IPv4 only, and IPv6 only.

The example requires grpc-java to already be built. You are strongly encouraged to check out a git release tag, since there will already be a build of grpc available. Otherwise, you must follow COMPILING.

Build the example

To build the dualstack example server and client. From the grpc-java/examples/example-dualstack directory run:

$ ../gradlew installDist

This creates the scripts build/install/example-dualstack/bin/dual-stack-server and build/install/example-dualstack/bin/dual-stack-client.

To run the dualstack example, run the server with:

$ ./build/install/example-dualstack/bin/dual-stack-server

And in a different terminal window run the client.

$ ./build/install/example-dualstack/bin/dual-stack-client

Maven

If you prefer to use Maven:

Run in the example-debug directory:

$ mvn verify
$ # Run the server in one terminal
$ mvn exec:java -Dexec.mainClass=io.grpc.examples.dualstack.DualStackServer
$ # In another terminal run the client
$ mvn exec:java -Dexec.mainClass=io.grpc.examples.dualstack.DualStackClient