producer
A closure which, when called, writes values into the provided writer and returns trailing metadata indicating the end of the response stream.
var producer: (RPCWriter<Message>) async throws -> Metadata
Returning metadata indicates a successful response and gRPC will terminate the RPC with an ok
status code. Throwing an error will terminate the RPC with an appropriate status code. You can control the status code, message and metadata returned to the client by throwing an RPCError
. If the error thrown is a type other than RPCError
then a status with code unknown
will be returned to the client.
gRPC will invoke this function at most once therefore it isn’t required to be idempotent.