Skip to content

Latest commit

 

History

History
 
 

grpc-client

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

gRPC client

Contains examples for gRPC clients using for Serving with gRPC

We will use bazel to build and run these examples.

Instruction

All clients are built to run with quickstart image:

docker run -it --rm -p 8888:8888 -p 3000:3000 -p 3001:3001 bentoml/quickstart:latest serve-grpc --production --enable-reflection

To get all available client rules:

bazel query //... --output label_kind | grep ":client" | sort | column -t

To build all rules for better caching:

bazel build ...

The following table contains commands to run clients:

Language Command
Python python client.py
C bazel run //grpc-client/cpp:client
Go bazel run //grpc-client/go:client
Java bazel run //grpc-client/java:client
Kotlin bazel run //grpc-client/kotlin:client
Swift ./swift/client
Node.js pushd node && yarn client && popd
PHP See PHP instruction
Rust See Rust instruction

For Swift client, make sure to compile gRPC Swift protoc beforehand to generate the client stubs.

Note that each of the above client examples are also working standalone if you wish not to use bazel.

Adding new language support

  • Update gRPC guides
  • Create a new language directory. Add a client.<ext> and BUILD
  • Add new rules to WORKSPACE
  • bazel run //:buildifier for formatting

TODO:

  • Write ruleset for compiling Swift
  • Write ruleset for running grpc-node