elcioabrahao / grpc-springboot-demo

Spring-boot microservice solution which contains a Netflix-Eureka discovery server and two microservice in Employee & Allocation domains. And interservice communication happens via gRPC.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gRPC - Spring boot Implementation

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.

High-level Architecture Diagram

How to Run

  1. Clone the repository to your local machine
  2. Navigate to the grpc-springboot-demo folder and run following command for build the project
    mvn package
  3. 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

Service Methods

  • 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}

About

Spring-boot microservice solution which contains a Netflix-Eureka discovery server and two microservice in Employee & Allocation domains. And interservice communication happens via gRPC.


Languages

Language:Java 100.0%