This directory contains a simple bar service written as a Kotlin gRPC example. You can find detailed instructions for building and running example from below
- Bar Service using gRPC and Kotlin. For details, see the project on github.
The starter sources are organized into the following top-level folders:
- protos:
.proto
files for generating the stubs - stub: regular Java & Kotlin stub artifacts from protos
- server: Kotlin servers based on regular stub artifacts
- client: Kotlin clients based on regular stub artifacts
-
Install Homebrew
Download and install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Install JDK
Install any version of JDK (8 preferred):
brew install openjdk@8
Add the installed version of JDK to your path through .zshrc or .bash_profile
echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
or
echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile
-
Clone the project and run the bar service and client starter
Clone and navigate into the project:
git clone https://github.com/hwslabs/grpc-kotlin-starter.git cd grpc-kotlin-starter
Start the server:
./gradlew :server:BarServer
If you wish to start the server on a docker container (assuming you have docker installed on your machine)
docker-compose up
This will start the server and open up the 50051 port for connections
In another console, run the client which will make requests to the server:
./gradlew :client:BarClient