August 29, 2019

building a gRPC application (part 1)

This is part one of a guided demonstration on how to build an application using gRPC. Each post represents one commit; you may follow along by reading and implementing yourself.

For this lesson, let’s look at what it takes to create a gRPC protocol definition set.

Design a protocol

You may think about gRPC as consisting of two aspects:

  • a specification of data message constructs
  • a specification of data communication patterns

It does not matter whether your role is a programmer, a product manager, a tester, or anything else in the organization. These two aspects of gRPC will help you reason about what the application does and how it does it.

The simplest protocol you can create looks like thus:

message UserInformation {
  string username = 1;

This specifies a template for data messages.

The simplest service you can create looks like thus:

service UserActivity {
  rpc Acknowledge(UserInformation) returns (UserInformation) {}

This specifies a template for data services.

At this stage, the key things to undestand is that the message describes what data gets communicated and the service describes the patterns for communicating with specified data.

Our example here merely defines a single message and a single pattern; the pattern here merely returns a message of the same type.

Browse the completed code for this lesson on Gitlab:

There’s plent more lessons to come, so stay tuned!

Content by © Jared Davis 2019-2020
Theme by © Emir Ribic 2017-2020

Powered by Hugo & Kiss.