https://github.com/wei-1/scala-grpc-helloworld
gRPC helloworld example in Scala
https://github.com/wei-1/scala-grpc-helloworld
grpc protobuf scala scalapb
Last synced: about 2 months ago
JSON representation
gRPC helloworld example in Scala
- Host: GitHub
- URL: https://github.com/wei-1/scala-grpc-helloworld
- Owner: Wei-1
- License: mit
- Created: 2018-08-09T03:15:13.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-14T07:40:29.000Z (almost 8 years ago)
- Last Synced: 2026-04-24T08:42:05.386Z (2 months ago)
- Topics: grpc, protobuf, scala, scalapb
- Language: Scala
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/Wei-1/Scala-gRPC-HelloWorld)
[](https://opensource.org/licenses/MIT)
# Scala-gRPC-HelloWorld
A scala version of the official HelloWorld GRPC example.
## Context
This repo is another example to use the [`sbt-protoc`](https://github.com/thesamet/sbt-protoc) plugin and implements gRPC services using [`scalaPB`](https://github.com/scalapb/ScalaPB).
The `HelloWorld` example is taken from [grpc-java](https://github.com/grpc/grpc-java) examples.
## How to use?
First, run
```
sbt compile
```
to create the case class GreeterGrpc.
Second, run
```
sbt "runMain io.grpc.helloworld.HelloWorldServer"
```
to start the HelloWorldServer.
Third, run
```
sbt "runMain io.grpc.helloworld.HelloWorldClient"
```
to start a client that will send a `world` to HelloWorldServer.
The server will reply with a `Hello world`.
## Why this repo?
After checking the [official repo of Scalapb with gRPC done by xuwei-k](https://github.com/xuwei-k/grpc-scala-sample),
I found that xuwei-k's example cannot be built alone and will need to have the [official Java repo](https://github.com/grpc/grpc-java) with it.
Also, his/her example doesn't follow the original build path `src`, which will cause some problems in my environment.
Therefore, I search for a simpler solution and found the [gRPC example from btlines](https://github.com/btlines/grpcexample).
btlines's example is very well written and support several different connection methods with easy and reliable control.
The only problem to me is that btlines's example uses a lot of his/her own dependencies to support the abundant connection methods.
For an example, I am looking for an easier approach.
By combining all these repositories, I created this repo for a basic Hello World example that you can just `compile` and `run`.
## Reference
- [grpc/grpc-java](https://github.com/grpc/grpc-java)
- [xuwei-k/grpc-scala-sample](https://github.com/xuwei-k/grpc-scala-sample)
- [btlines/grpcexample](https://github.com/btlines/grpcexample)