Skip to content

junplus/grpc-service-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC Example

This is a example for using gRPC, which is a high performance, open-source universal RPC framework from Google.

This project demonstrates how to write gRPC server and client application using Java. A python client also been proposed to examine the across languages feature of gRPC.

More Details about this project can be found on my blog.

how to Build

Java server & client

To build this demo, run in this directory:

$ ./gradlew installDist

This creates the scripts JRService-server, JRService-client in the build/install/examples/bin/ directory. Remember to run the server first before runing the client.

$ ./build/install/examples/bin/JRService-server

Then in another terminal window,

$ ./build/install/examples/bin/JRService-client

That's it.

Python client

Install gRPC first:

$ sudo pip install grpcio
$ sudo pip install grpcio-tools

Generate the Python code using folling commond:

$ python -m grpc.tools.protoc -I./proto --python_out=. --grpc_python_out=. ./proto/jr.proto

Then run the client:

$ python jr_service_client.py

About

A rpc example using gRPC.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 63.1%
  • Python 25.8%
  • Protocol Buffer 11.1%