Example gRPC server implemented in Java
Please follow the install setup for Java first before deploying this java app.
Deploy the app
export DOMAIN=my.cf.app.domain
cf push -f app-manifest.yml --var domain=$DOMAIN
cf push --no-route java-grpc-test --buildpack java_buildpack --path ./app/build/distributions/app.zip
# my.cf.app.domain is used as an example for demonstration purpose
cf map-route java-grpc-test my.cf.app.domain --hostname java-grpc-test --app-protocol http2
grpcurl
needs to be installed separately.
grpcurl -proto app/src/main/proto/example.proto java-grpc-test.my.cf.app.domain:443 example.Example.Run
./gradlew build
PORT=8080 ./gradlew run
grpcurl -proto app/src/main/proto/example.proto -plaintext localhost:8080 example.Example.Run
This example uses Gradle Wrapper, which will download and use the appropriate Gradle version to build the project.
A Java installation, e.g. openjdk, is required for this sample.