The Spring Boot gRPC Messaging Sample is a hands-on showcase of integrating gRPC communication into Spring Boot applications. It demonstrates the seamless interoperability between server and client, leveraging the power of gRPC to streamline communication.
The repository provides a comprehensive guide on setting up gRPC services using Spring Boot. It covers everything from defining structures in the proto file to implementing synchronous, asynchronous, and bidirectional communication methods.
-
gRPC Integration: Demonstrates seamless integration of gRPC communication within Spring Boot applications, highlighting its efficiency and ease of use.
-
Proto File Definitions: Utilizes the
messaging.proto
file to define message structures, including requests, responses, and service definitions, ensuring a standardized communication protocol. -
Various Service Types: Explores and implements different gRPC service types, such as synchronous unary calls, client-streaming, and bidirectional streaming methods, showcasing their diverse functionalities. For an alternative implementation using reactive programming techniques, switch to the
reactive_grpc
branch. This branch demonstrates the same functionalities but leverages reactive paradigms for implementation. -
Practical Start-Up Guide: Provides a straightforward process to start the application, enabling developers to quickly set up and run the gRPC-powered Spring Boot project.
-
Interoperability Illustration: Illustrates how gRPC services, while efficient, might face limitations when accessed directly from browsers and suggests a simple solutions through the
ProtobufJsonFormatHttpMessageConverter
bean inProtobufJsonConverterConfig.java
which encode and decode protobuf data into a more accessible JSON format.
- Clone the repository
- Navigate to the root directory
- Run
mvn clean install
- Start the server-service with
By default, the server-service will start
java -jar server-service/target/server-service-0.0.1-SNAPSHOT.jar
- a gRPC server on port 9090;
- a server for API request on port 9091.
- Start the client-service with
By default, the client-service will run on port 8080.
java -jar client-service/target/client-service-0.0.1-SNAPSHOT.jar