clientStreamingServerMethodDefinition

fun <RequestT, ResponseT> clientStreamingServerMethodDefinition(context: CoroutineContext, descriptor: MethodDescriptor<RequestT, ResponseT>, implementation: suspend (requests: Flow<RequestT>) -> ResponseT): ServerMethodDefinition<RequestT, ResponseT>

Creates a ServerMethodDefinition that implements the specified client-streaming RPC method by running the specified implementation and associated implementation details within a per-RPC CoroutineScope generated with the specified CoroutineContext.

When the RPC is received, this method definition will pass a Flow of requests from the client to implementation, and send the response back to the client when it is returned. Exceptions are handled as in unaryServerMethodDefinition. Additionally, attempts to collect the requests flow more than once will throw an IllegalStateException, and if implementation cancels collection of the requests flow, further requests from the client will be ignored (and no backpressure will be applied).

Parameters

context

The context of the scopes the RPC implementation will run in

descriptor

The descriptor of the method being implemented

implementation

The implementation of the RPC method

Sources

jvm source
Link copied to clipboard