/Scala-gRPC-HelloWorld

gRPC helloworld example in Scala

Primary LanguageScalaMIT LicenseMIT

Build Status

License

Scala-gRPC-HelloWorld

A scala version of the official HelloWorld GRPC example.

Context

This repo is another example to use the sbt-protoc plugin and implements gRPC services using scalaPB.

The HelloWorld example is taken from 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,

I found that xuwei-k's example cannot be built alone and will need to have the official Java repo 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.

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