Book Image

gRPC Go for Professionals

By : Clément Jean
Book Image

gRPC Go for Professionals

By: Clément Jean

Overview of this book

In recent years, the popularity of microservice architecture has surged, bringing forth a new set of requirements. Among these, efficient communication between the different services takes center stage, and that's where gRPC shines. This book will take you through creating gRPC servers and clients in an efficient, secure, and scalable way. However, communication is just one aspect of microservices, so this book goes beyond that to show you how to deploy your application on Kubernetes and configure other tools that are needed for making your application more resilient. With these tools at your disposal, you’ll be ready to get started with using gRPC in a microservice architecture. In gRPC Go for Professionals, you'll explore core concepts such as message transmission and the role of Protobuf in serialization and deserialization. Through a step-by-step implementation of a TODO list API, you’ll see the different features of gRPC in action. You’ll then learn different approaches for testing your services and debugging your API endpoints. Finally, you’ll get to grips with deploying the application services via Docker images and Kubernetes.
Table of Contents (13 chapters)

RPC types

Now that we know that there are four RPC operations, we can see how they are combined to create the different RPC types that gRPC provides. We will talk about the Unary, Server Streaming, Client Streaming, and Bidirectional RPC types. We will see that each type presented is a combination of the RPC operations presented earlier.


A unary RPC is an RPC that performs one request and returns one response. We already touched upon this in the previous section, but let us go ahead and make the process clearer.

As always, the first step is the client sending the initial header. This header will contain the information related to the RPC endpoint that we want to invoke. As of this point in the book, we simply need to know that this mostly includes the RPC route and the stream ID. The former is to let the server know which user code function it should call to process the request. The latter is a way to identify on which stream the data should be sent. This is because...