Skip to content

Sample Spring Boot app using gRPC for bidirectional messaging, showcasing client-server communication

License

Notifications You must be signed in to change notification settings

federicopellegatta/springboot-grpc-messaging-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC Messaging Application with Spring Boot

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.

Key Features

  1. gRPC Integration: Demonstrates seamless integration of gRPC communication within Spring Boot applications, highlighting its efficiency and ease of use.

  2. Proto File Definitions: Utilizes the messaging.proto file to define message structures, including requests, responses, and service definitions, ensuring a standardized communication protocol.

  3. 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.

  4. 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.

  5. 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 in ProtobufJsonConverterConfig.java which encode and decode protobuf data into a more accessible JSON format.

Getting Started

Prerequisites

Running the Application

  1. Clone the repository
  2. Navigate to the root directory
  3. Run mvn clean install
  4. Start the server-service with
    java -jar server-service/target/server-service-0.0.1-SNAPSHOT.jar
    By default, the server-service will start
    • a gRPC server on port 9090;
    • a server for API request on port 9091.
  5. Start the client-service with
    java -jar client-service/target/client-service-0.0.1-SNAPSHOT.jar
    By default, the client-service will run on port 8080.

About

Sample Spring Boot app using gRPC for bidirectional messaging, showcasing client-server communication

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages