January 2020
Intermediate to advanced
640 pages
16h 56m
English
We will be taking a slightly unorthodox approach and start by defining our one and only RPC first. The reason for this is that the selection of the RPC type (unary versus stream) will greatly influence the way we define the various payloads.
For example, if we opt to use a streaming RPC, we will need to define a kind of envelope message that can represent the different types of messages exchanged between the master and the workers. On the other hand, if we decide in favor of unary RPCs, we can presumably define multiple methods and avoid the need for envelope messages.
Without further ado, let's take a look at the RPC definition for our job queue:
service JobQueue { rpc JobStream(stream WorkerPayload) returns ...