A brief intro into what gRPC is, and what the benefits are
Hey folks, welcome back. So now we have a good idea of what Protocol Buffers is and how it works. So let's start talking about gRPC. What is gRPC? It's an open-source RPC framework written by Google that runs over HTTP/2. It uses Protocol Buffers for data serialization and is designed to be language-agnostic. gRPC is also designed for distributed systems, so it supports features like load balancing, tracing, health checking, and authentication out of the box, making it easy to configure these features.
The workflow for building gRPC services looks something like this: The first step is to define a Protocol Buffers contract. I'll go through this in more detail in a minute, but essentially, you define your service and the messages it sends and receives in a `.proto` file. Then you compile this file into client and server code using the Protocol Buffers compiler.
Once you've defined your service and compiled your code, the next step is to implement the server. In Go, you would do this by creating a struct that implements the interface generated from your `.proto` file. You'll then start the server and register your service implementation with it. The gRPC server will handle incoming requests and call the appropriate methods on your service implementation.
On the client side, you'll use the generated client code to call the server. You create a client connection to the server and then use the client methods to send requests and receive responses. This allows you to easily interact with your gRPC services from any supported language.
That's the high-level overview of how gRPC works. Now let's dive into the details of defining a Protocol Buffers contract and implementing a gRPC service in Go.