Who Should Take This Course and Why?
Get introduced to the target audience and the learning outcomes of this course and the prerequisites, if any.
We'll cover the following...
Welcome to the course, where we will learn about the fundamentals of gRPC, how it enables efficient communication between distributed systems, and how to implement gRPC services and clients in Java. The goal of this course is to help you understand gRPC so you can build various applications, starting with a file-sharing app as a practical example.
Prerequisites
Since this is a beginner-level course, only basic programming knowledge is required. The prerequisites for this course are familiarity with Java, as the project and hands-on exercise will be in this language.
Additionally, a basic understanding of asynchronous programming concepts is important because gRPC leverages asynchronous messaging to efficiently handle communication between services. This knowledge will help you grasp how gRPC works behind the scenes and how it manages multiple simultaneous connections in a non-blocking way.
Target audience
This course is designed for:
Beginners with no prior experience in gRPC or microservices development.
However, the content is grouped in a way that a web developer looking to bridge gaps in their current knowledge can also benefit from this course.
Developers who want to learn a new concept to advance in their careers, as well as those who are curious about gRPC.
Architects who need to understand gRPC use cases to decide when it’s the right choice for a project.
What to expect
The way this course is structured, theory and practice go hand in hand. We will learn about the gRPC theory and implement it.
Instead of using ready-made code, we will write everything from scratch, making it a coding-intensive course. We will create a file-sharing application in which the client will communicate with the server using gRPC. Since gRPC supports four types of RPC methods, our application will implement them as follows: Unary RPC for deleting a file, client streaming RPC for uploading a file in chunks, server streaming RPC for reading a file in chunks, and bidirectional streaming RPC for fetching metadata of multiple files.
We will also demonstrate how to make the application secure according to industry standards. We will generate SSL certificates and enable server and client authentication.
Demo project
The demo of the complete project is shown below. You can connect the terminal to get the server up and running. Then open another tab in the terminal by clicking the "+
" sign and start the client by executing the following command. The command in line 2 creates a file named testFile
, which we will transfer to the server.
cd BiDiInsecureClientBinariesecho "This is my sample file" > testFile
The following commands can be used to test the four RPCs. Note the appropriate messages being displayed on the server and client terminal windows.
Add a file:
java -cp ftp-service-cli-client-1.0.2-jar-with-dependencies.jar io.datajek.ftpservice.cliclient.SampleCLIClient -add testFile -server localhost -out myFile
Read a file:
java -cp ftp-service-cli-client-1.0.2-jar-with-dependencies.jar io.datajek.ftpservice.cliclient.SampleCLIClient -read myFile -server localhost
Fetch Metadata:
java -cp ftp-service-cli-client-1.0.2-jar-with-dependencies.jar io.datajek.ftpservice.cliclient.SampleCLIClient -attr "thisFile myFile" -server localhost
Delete a file:
java -cp ftp-service-cli-client-1.0.2-jar-with-dependencies.jar io.datajek.ftpservice.cliclient.SampleCLIClient -del myFile -server localhost
Learning outcomes
We will cover the following topics in this course:
Understand gRPC fundamentals like client-server communication, architecture, and asynchronous nature.
Grasp the workings of gRPC by learning about server and client configurations.
Develop and configure efficient gRPC services using Protocol Buffers and create
.proto
files for defining messages and services.Implement gRPC servers and clients by utilizing autogenerated gRPC code for efficient communication.
Build command-line interface (CLI) clients for interacting with gRPC services, such as FTP.
Understand the different types of gRPC APIs and implement streaming methods using the
StreamObserver
interface.Implement unary RPC by developing server-side and client-side for deleting a file on the FTP server.
Implement client streaming RPC by developing the
addFile
RPC where the client divides the file in chunks and sends it to be stored on the server.Implement server streaming RPC by developing server-side and client-side server streaming RPC, in which the client requests to read a file from the server, and the server sends the file in small chunks.
Learn bidirectional streaming RPC for real-time communication, implementing both client-side and server-side logic to get metadata of multiple files on the server.
Solidify gRPC concepts through exercises focused on text manipulation, API implementation, and streaming RPC methods.
Implement TLS authentication and SSL certificate management to secure gRPC communication for both server and client, including CLI client authentication.
Test and validate the performance and reliability of gRPC-based services like the FTP service.