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 unary RPC
Unary RPC is the simplest form of the service method. Both the client and the server send the single object. Let's find out how it works. Unary RPC is initiated by the client. The client calls a stub
method. stub
notifies the server that the RPC call has been invoked. 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 call 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 on the...