The goal of this project is to implement two Spring Boot
applications using gRPC
: the server, called movie-grpc-server
, and the shell client, named movie-grpc-client
. The library movie-grpc-lib
defines the gRPC
interface that both the server and client applications use.
On ivangfr.github.io, I have compiled my Proof-of-Concepts (PoCs) and articles. You can easily search for the technology you are interested in by using the filter. Who knows, perhaps I have already implemented a PoC or written an article about what you are looking for.
-
movie-grpc-lib
A Maven project that defines the
gRPC
interface (usingProtocol Buffers
) for managing movies. This library is shared by both themovie-grpc-server
andmovie-grpc-client
to ensure they can communicate properly overgRPC
. -
movie-grpc-server
A Spring Boot web application that has
movie-grpc-lib
as dependency. It implements thegRPC
functions for managing movies and runs agRPC
server to handlemovie-grpc-client
calls. The movies are stored in aPostgreSQL
database. -
movie-grpc-client
A Spring Boot shell application that has
movie-grpc-lib
as dependency. It has astub
used to callmovie-grpc-server
functions.
In a terminal and inside the spring-boot-grpc-client-server
root folder, run the command below:
./mvnw clean install --projects movie-grpc-lib
Run the command below to start postgres
Docker container
docker run -d --name postgres \
-p 5432:5432 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=moviesdb \
postgres:17.2
-
movie-grpc-server
In a terminal and inside the
spring-boot-grpc-client-server
root folder, run the following command:./mvnw clean spring-boot:run --projects movie-grpc-server
-
movie-grpc-client
Open another terminal, make sure you are in the
spring-boot-grpc-client-server
root folder. Then, run the command below to build the executable jar file:./mvnw clean package --projects movie-grpc-client -DskipTests
Finally, to start the client shell, run:
./movie-grpc-client/target/movie-grpc-client-0.0.1-SNAPSHOT.jar
- To stop the applications, go to the terminals where they are running and press
Ctrl+C
; - To stop the
postgres
Docker container, run:docker rm -fv postgres