Enhancing Application Communication with gRPC

Remote Procedure Calls have been used to allow clients and servers to communicate with each other, but they have been stigmatized as been cumbersome and brittle. This course will introduce you to gRPC - a modern and efficient RPC framework by Google.
Course info
Rating
(39)
Level
Intermediate
Updated
Jan 13, 2017
Duration
6h 42m
Table of contents
Course Overview
Introduction
gRPC Concepts
Preparing for gRPC
Creating gRPC Servers with Go
Creating gRPC Clients with Go
Creating gRPC Servers with C#
Creating gRPC Clients with C#
Creating gRPC Server with Node.js
Creating gRPC Clients with Node.js
Creating gRPC Servers in Java
Creating gRPC Clients in Java
Description
Course info
Rating
(39)
Level
Intermediate
Updated
Jan 13, 2017
Duration
6h 42m
Description

There have been many different strategies over the years to get software written in one language to communicate with one written in another. The two primary approaches that have evolved have been RESTful services (typically using JSON documents to transmit data) and RPC (remote procedure calls) that use a variety of different transmission techniques. In this course, Enhancing Application Communication with gRPC, you'll be introduced to the gRPC framework that Google uses for much of its inter-service communication. First, you'll cover the components of gRPC application. Next, you'll discover how to use protocol buffers to define gRPC services. Finally, you'll learn how to create gRPC clients and servers using C#, Java, Node.js, and Go. By the end of this course, you'll know how to use gRPC in your distributed system applications.

About the author
About the author

Michael Van Sickle is an application architect in Akron, Ohio. He is a mechanical engineer by training and a software engineer by choice. He is passionate about learning new programming languages and user experience design.

More from the author
The Go CLI Playbook
Intermediate
2h 8m
28 Feb 2018
Intern 4: Getting Started
Beginner
2h 41m
9 Jan 2018
Object-oriented Programming with Go
Intermediate
1h 42m
11 Aug 2017
More courses by Mike Van Sickle
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone, my name is Michael Van Sickle. Welcome to my course Enhancing Application Communication with gRPC. I'm a software engineer at SightPen. There have been many different strategies over the years to get software written in one language to communicate with one written in another. The two primary approaches that have evolved have been restful services and remote procedure calls. This course will introduce you to the gRPC framework that Google uses for much of its inner service communication. You'll learn how Google uses gRPC's fast, efficient, strongly typed messaging to deliver high performance services that operate at Google scale. Throughout the course we will investigate to use gRPC in four major languages. C#, JavaScript with Node, Java, and Go. Some of the major topics that we'll cover include the components of a gRPC application, how to use protocol buffers to define gRPC services, and how to create gRPC clients and servers using C#, Java, Node JS, and Go. By the end of this course you'll know how to use gRPC in your distributed system applications. Before beginning the course you should be familiar with one of the following languages; Go, C#, Java, or JavaScript with Node JS. I hope you'll join me on this journey to learn gRPC with the Enhancing Application Communication with gRPC course at Pluralsight.

gRPC Concepts
Hello, and welcome back to this course, where we're learning how to do inter-service communication using gRPC. In the last module, we got acquainted with gRPC and learned a little bit about the history of it, as well as getting our first taste of what it's like to have two services communicate using gRPC. In this module, we're going to dig into the concepts that underlie the gRPC framework so we can see all the pieces that we have available and how they fit together. We're going to start by talking about the basic structure of gRPC, and what I mean by this is the basic components that you're going to be working with when you're building a client and a server using gRPC and getting them to communicate with one another. Then, I want to move into talking about the design cycle. Now, it's relatively straightforward, but I think it's worth seeing how you go from the user story that you're trying to implement all the way through the implementation of the code that executes that user story. And then we'll move into a discussion of the RPC life cycle itself. Now, the design cycle is, of course, at design time, when you're writing your application, but the RPC life cycle is going to execute at runtime, and this is how an actual remote procedure call executes using gRPC. From there, we'll move onto authentication. Now, this might not be the authentication that you initially would think about. This isn't going to be authenticating users. What we're going to talk about here are the tools and techniques that are available in order to authenticate servers and clients to make sure that we're communicating securely with one another. And finally, I want to talk about the message types that gRPC supports and talk about where each one might be useful. Okay, so let's get started by talking about the basic structure of a gRPC-enabled software system.

Preparing for gRPC
Hello, and welcome back. In the last module, we finished a discussion about the theory and the concepts that we're going to have to be familiar with as we start to work with gRPC. In this module, we going to start transitioning away from a heavy discussion on theory and start moving toward some engineering and some heavy software development. But before we get into doing the engineering with gRPC we need to take a few minutes to talk about how we're going to define the messages that are going to allow our clients and servers to talk to each other. So that discussion is going to break down to three parts. First, we're going to be using protocol buffers in order to transport our messages. And so I want to do a brief review of protocol buffers so just in case it's been a while since you used them, you're reminded about how they work and if you haven't worked with protocol buffers before then I'll point you to some resources that you can use in order to get up to speed. Next I want to talk about gRPC message types. And we talked about this in the last module and this is going to be a slightly different discussion. This isn't going to be the theory about the message types that are available. This is going to be the practical side about when you're actually defining the gRPC methods that you're going to have your service exposed, how do you actually do that. What are the constraints and what are the requirements? And then we're going to finish this module up by getting into some code. And creating the message definitions that we're going to be using throughout the rest of this course. Okay, let's go ahead and get started by jumping into a review of protocol buffers.

Creating gRPC Servers with Go
Hello and welcome back. In the last few modules, we've been setting up and really understanding the theory and the structures behind gRPC. In the last module, we got back into some code and learned how protocol buffers really fit in a gRPC architecture. Well in this module and, as a matter fact, for the rest of the modules of this course, we're going to be applying gRPC and building servers and clients in multiple different languages. Well first up, we're going to be building a gRPC server with Go and we're going to do that in several stages. The first thing that we're going to do is we're going to learn how to create the Go source code using our protocol buffer message definition files. Then we'll learn how to set up a secure connection for our gRPC server so that when clients connect to it, we can be sure that information sent to and received from them is transferred securely. Then we'll go under the discussion about how to receive metadata from a client. And we talked about metadata a little bit before and that's data about the message that's being sent. So in this section, we're going to learn how to send data from the client to the server and then receive that. After that, we're going to go into a series of discussions about the various RPC calls that we can make. So we'll talk about unary messages, server streaming, client streaming and bidirectional streaming. And finally, we'll learn how to integrate gRPC in the real world applications by going back to our course demo, that vacation tracking demo and upgrade the data service server that we have written in Go over to use gRPC. Okay, so let's go ahead and get started by learning how to generate the source code for our Go server.

Creating gRPC Clients with Go
Hello, and welcome back. In the last module, we went through the process of creating a gRPC server using the Go language. Well now it's time to reverse things, and learn how to create a client in Go that's going to be able to communicate with a gRPC server. We're going to approach this in a manner very similar to the last module. We're going to go through step by step, and slowly build up a client that exercises different aspects of the gRPC framework, so we can see how to work with those one at a time. We're going to start by learning how to create a secure connection from the client side. Then we're going to learn how to send Metadata as a counterpoint to the receiving of Metadata that we talked about in the last module, and then we're going to go through each of the RPC calls that we can make. So just to review those one more time. We're going to make a Unary call, then we're going to look at server side streaming, then we're going to explore client streaming, and finally bidirectional streaming. So as you might imagine, we're going to be seeing an awful lot of code in this course, and not too many more slides. So, without further adieu, let's dive into our first demo and learn how to create a secure connection for our clients to communicate with a gRPC server.

Creating gRPC Servers with C#
Hello, and welcome back to this course where we're learning how to use gRPC in our applications. In the last couple of modules, we worked through creating servers and clients, in the go language. In this module, in the next one, we're going to be following a very similar pattern. But this time, we're going to be working in C#. So if you watched the last couple of modules, then our outline is going to be pretty familiar. Because really for the rest of this course we're pretty much going to be following the same pattern. We're going to start out by learning how to create a server in C#, by learning how to generate the source code from our protocol buffer message definition files. Then we're going to learn how to create a secure connection that our clients can use to communicate with our server. We're going to learn how to receive metadata. And then we're going to go step by step through those four RPC calls. So we're going to learn how to work with unary messages, server side streaming messages, client side streaming messages, and then we'll wrap up with bidirectional streaming. Okay, so let's get started by learning how to generate our C# source code from our protocol buffer messages.

Creating gRPC Clients with C#
Hello and welcome back to the course. In the last module, we finished up a discussion where we learned how to create a gRPC server using the C# language. Well in this module, we're going to finish up our discussion of C# by learning how to create a gRPC client. Now a lot of the ground work that we need to create a gRPC client we established in the last module, so we're not going to go back over that material again. So generating source code and things like that, we've already talked about. So in this module, we're going to start by learning how to create a secure connection. That is, if we have the gRPC server that only accepts secure connections, we're going to learn how to create a client that's going to be able to communicate with that. We'll then learn how to send metadata from the client in order to describe the context that an RPC call should be interpreted in. At that point, we should be setup to talk about the four different types of RPC calls that we can make. We'll learn how to initiate unary RPC calls, we'll learn how to initiate server side streaming, then client side streaming, and finally, we'll learn how to initiate bidirectional streaming messages. At the end of this module, I want to go back to the course demo and show you some of the differences that you're going to have to keep in mind moving from a purely RPC based system into one that's actually dealing with true entities and classes, more of a realistic demo. So we'll go back to that vacation tracker service and we'll learn how to get it to communicate with our data service, which is written Go. Okay, so let's go ahead and get started by learning how to establish a connection to a secure server using gRPC and C#.

Creating gRPC Server with Node.js
Hello, and welcome back to this course where we're learning how to use gRPC to create fast, efficient, and reliable communication between clients and servers. Over the last few modules we've been taking languages one at a time and learning how to implement clients and servers using them. So we've already gone through Go and C-Sharp. And I hope that one of those languages has sparked your interest, and you've gone through those modules. Well in this module and the next one, we're going to learn how to use Node and JavaScript to create gRPC servers in that language. Now in a lot of ways, this module and the next are going to be the most fun in the course, in my opinion. And that's because Go, C-Sharp, and Java are statically-typed languages, and so we always have to be aware of the type-system. And while that provides a lot of benefits for us, it also means that we have a lot of considerations we have to make when we're working with them. With JavaScript, being a dynamically-typed language, things can become a lot more streamlined and easy to work with. And as a first example, let me show you this first point that we're going to be talking about. We're going to jump right into creating a secure connection. Now if you've gone through the Go or C-Sharp demos, I've always started with how to create the source code. With Node, we're actually going to see that we're going to get the source code for free. So that's going to save us a lot of time as we try and get our Node environments up and running. We're then going to move on to learn how to receive metadata from a client. And then we're going to go through and follow the pattern that we've established already in previous demos, and go through the various types of RPC calls. So we'll talk about unary messages, server-side streaming, client-side streaming, and bidirectional streaming. Okay, so without further ado let's jump into a demo, learn how to create a secure connection, and along the way we'll see how to get access to our services and messages that are defined in that protocol buffer file.

Creating gRPC Clients with Node.js
In the last module, we went through the process of creating a gRPC server that was using Node in Javascript. In this module, we're going to reverse things. We're going to take that server that we built in the last module, and we're going to build up a client that's going to talk to it. Now, the order that we're going to go through things is going to be very similar to that previous discussion. We're going to start by learning how to create a secure connection to that server, we're going to learn how to send metadata to it, and then we'll go through each one of the different types of RPC calls, so we'll learn how to work with Unary RPC calls, then server streaming calls, client streaming, and finally wind up with bidirectional streaming calls. And then at the end of the module, I want to come back to that course demo and revisit it a little bit, and the reason for that is the demos that we've been working with so far with Node are all going to be working in this purely gRPC world. But once you start interacting with database entities and things like that, there are some additional things that you're going to have to consider, so I want to revisit the course demo, see what it took to convert it from working with mock data to interacting with a real data service using gRPC so that you have some ideas of the things that you might have to keep an eye out for when you start building your own application with gRPC. Okay. So let's jump right into our first demo and learn how to create a secure connection to our server using Node.

Creating gRPC Servers in Java
Hello and welcome back to the course. In the last two modules, we learned how to create gRPC servers and clients with JavaScript. In this module and the next, we're going to wrap up our discussion of the various languages by learning how to create those same servers and clients using Java. Now this is going to be a little bit of a different discussion than the JavaScript discussion, because whereas the JavaScript implementation of gRPC really leverages the dynamic nature of that language to provide a very transparent interface, with Java, were going to have a lot more fine grain control over the gRPC implementation. Now, along with that fine grain control, we're going to see that we're also going to have a lot more code involved. Now this discussion is going to follow a very similar pattern to the other server discussions that we've had. First, we're going to start by learning how to generate our source code. And this is the first difference we're going to see between Java and JavaScript. Because whereas JavaScript we don't have to generate the source code at all, we just load those protocol buffer message definition files directly. In Java, we actually have three different ways to generate source code, because of the different build systems that are available in the environment. After we get that source code generated, then we're going to learn how to create a secure connection for our clients to communicate with us. We'll learn how to receive metadata from those clients. And then we'll go through the four different types of RPC calls. So we'll go through unary, server side streaming, client side streaming, and bidirectional streaming. Now there's a lot of material for us to cover in our Java discussion. So let's jump right in and learn the three different ways that we have to generate source code when we're using Java.

Creating gRPC Clients in Java
In the last module we learned how to create gRPC servers using Java. In this module, we're going to complete our conversation about Java by learning how to create gRPC clients. Now, in order to learn how to do that we're going to go through several steps that are going to mirror what we did on the server side. So we're going to start by creating a secure connection. We're then going to move on and learn how to send Metadata to a server from a client, and then we'll go through a discussion of the four different RPC Calls. So we'll learn about unary calls, server streaming calls, client streaming calls, and bidirectional streaming calls, and we'll learn how to make those and send those to the server. And then as a final topic, what I want to do is go back to the course demo that we introduced at the beginning of this course and talk about some of the things you're going to have to consider as you apply gRPC into your real world applications. Okay, so let's go ahead and get started by learning how to talk to a server that requires a secure connection.