The helloworld example is a slightly modified version of the helloworld example from gRPC Java examples.
To build the helloworld service, provision a WildFly server with the gRPC subsystem and any necessary certificate files,
and deploy the service, run:
cd service
mvn clean package -Dssl=<SSL>where SSL is either
none: plaintextoneway: server identity is verifiedtwoway: both server and client identities are verified
Then, run the server with:
./target/wildfly/bin/standalone.sh --stability previewThe helloworld client is a simple Java application. To build it, run:
cd client
mvn packageThis produces a fat JAR that can be launched directly:
java -jar target/helloworld-client.jar [options] [name]| Argument | Default | Description |
|---|---|---|
--ssl=<mode> |
none |
SSL mode: none, oneway, or twoway (defaults to none, must match the server) |
name |
world |
Name to greet (defaults to world) |
Start the server in one terminal:
cd service
mvn clean package -Dssl=none
./target/wildfly/bin/standalone.sh --stability previewRun the client in another terminal:
cd client
java -jar target/helloworld-client.jar BobAlternatively, you can use gRPCurl to invoke the service.
Run these commands from the examples/helloworld directory:
# clear text connection
grpcurl -proto proto/src/main/proto/helloworld.proto \
-plaintext \
-d '{"name":"Bob"}' \
localhost:9555 helloworld.Greeter/SayHello# tls (oneway)
grpcurl -proto proto/src/main/proto/helloworld.proto \
-cacert ../../ssl-gen/target/generated-ssl/client.truststore.pem \
-d '{"name":"Bob"}' \
localhost:9555 helloworld.Greeter/SayHello# mutual TLS (twoway)
grpcurl -proto proto/src/main/proto/helloworld.proto \
-cacert ../../ssl-gen/target/generated-ssl/client.truststore.pem \
-cert ../../ssl-gen/target/generated-ssl/client.crt.pem \
-key ../../ssl-gen/target/generated-ssl/client.key.pem \
-d '{"name":"Bob"}' \
localhost:9555 helloworld.Greeter/SayHello