Skip to content

kishiguro/grpc-clj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC from Clojure

This is example of calling gRPC API from Clojure.

gRPC Java

To use gRPC from Clojure, we need to set up gRPC Java environment first. We can use Maven or Gradle for project set up. In this example, we use Gradle.

Install Gradle

When gradle is not installed on your system, need to install it first.

  • Linux
$ sudo apt install gradle
  • Mac OS
$ brew install gradle

Prepare build.gradle and proto file.

We use stripped version of gRPC Java Example build.gradle. Original bulid.gradle is located at here.

Proto file should be located in src/main/proto. In this example, route_guide.proto is used.

Generate project with gradle.

$ gradle generateProto
Starting a Gradle Daemon (subsequent builds will be faster)
:extractIncludeProto
:extractProto
:generateProto NO-SOURCE

BUILD SUCCESSFUL

Total time: 11.012 secs

This will generate gRPC java stub under build directory from route_guide.proto.

Leiningen for Java and Clojure mixed-code

To use Java and Clojure mixed-code, :java-source-paths parameter to set up project.clj.

  :java-source-paths ["build/generated/source/proto/main"]

Example Server

Example Client

About

gRPC from Clojure

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published