Exploring the RPC life cycle
In the previous section, you learned about four types of service definitions. Each type of service definition has its own life cycle. Let’s find out more about the life cycle of each service definition in this section:
- The life cycle of a unary RPC: A unary RPC is the simplest form of service method. Both the client and the server send a single object. Let’s find out how it works. A unary RPC is initiated by the client. The client calls a stub method, which notifies the server that the RPC has been invoked.
A stub
also provides the server client’s metadata, the method name, and the specified deadline, if applicable, with notification.
Metadata is data about the RPC in the form of key-value pairs, such as timeout and authentication details.
Next, in response, the server sends back its initial metadata. Whether the server sends initial metadata immediately or after receiving the client’s request message depends...