In this implementation, We build a spring boot microservice solution which contains a Netflix-Eureka discovery server and two microservice in Employee & Allocation domains. And the interface project contains the raw protocol-buffer files and using the protocol buffer compiler maven plugin generates the java model and service classes.
- Clone the repository to your local machine
- Navigate to the grpc-springboot-demo folder and run following command for build the project
mvn package
- Run applications using following commands
java -jar grpc-springboot-demo\demo-eureka-server\target\demo-eureka-server-0.0.1-SNAPSHOT.jar
java -jar grpc-springboot-demo\demo-employee-service\target\demo-employee-service-0.0.1-SNAPSHOT.jar
java -jar grpc-springboot-demo\demo-allocation-service\target\demo-allocation-service-0.0.1-SNAPSHOT.jar
-
Unary RPCs (gRPC Server: employee-service, gRPC Client: allocation-service)
Proto Definition:rpc getEmployee (Employee) returns (Employee) { }
End Point:{IP Address}:8082/allocation/{allocationID}
-
Server streaming RPCs (gRPC Server: allocation-service, gRPC Client: employee-service)
Proto Definition:rpc getAllocationByEmployee (Allocation) returns (stream Allocation) { }
Synchronous End Point:{IP Address}:8089/employee/{employeeID}/allocation
Asynchronous End Point:{IP Address}:8089/employee/{employeeID}/allocation?isSyncClient=N
-
Client streaming RPCs (gRPC Server: employee-service, gRPC Client: allocation-service)
Proto Definition:rpc getMostExperiencedEmployee (stream Employee) returns (Employee) { }
End Point:{IP Address}:8082/{projectID}/allocation/getexperiencedemployeeinproject
-
Bidirectional streaming RPCs (gRPC Server: employee-service, gRPC Client: allocation-service)
Proto Definition:rpc getAllEmployeesByIDList (stream Employee) returns (stream Employee) { }
End Point:{IP Address}:8082/allocation?projectID={projectID}