public sealed class AsyncClientStreamingCall<TRequest, TResponse> : IDisposable
Return type for client streaming calls.
Implements
IDisposableNamespace
Grpc.CoreAssembly
Grpc.Core.Api.dll
Type Parameters |
|
---|---|
Name | Description |
TRequest |
Request message type for this call. |
TResponse |
Response message type for this call. |
Constructors
AsyncClientStreamingCall(IClientStreamWriter<TRequest>, Task<TResponse>, Func<object, Task<Metadata>>, Func<object, Status>, Func<object, Metadata>, Action<object>, object)
public AsyncClientStreamingCall(IClientStreamWriter<TRequest> requestStream, Task<TResponse> responseAsync, Func<object, Task<Metadata>> responseHeadersAsync, Func<object, Status> getStatusFunc, Func<object, Metadata> getTrailersFunc, Action<object> disposeAction, object state)
Creates a new AsyncClientStreamingCall object with the specified properties.
Parameters | |
---|---|
Name | Description |
requestStream |
IClientStreamWriter Stream of request values. |
responseAsync |
Task The response of the asynchronous call. |
responseHeadersAsync |
FuncobjectTaskMetadata Response headers of the asynchronous call. |
getStatusFunc |
FuncobjectStatus Delegate returning the status of the call. |
getTrailersFunc |
FuncobjectMetadata Delegate returning the trailing metadata of the call. |
disposeAction |
Actionobject Delegate to invoke when Dispose is called on the call object. |
state |
object State object for use with the callback parameters. |
AsyncClientStreamingCall(IClientStreamWriter<TRequest>, Task<TResponse>, Task<Metadata>, Func<Status>, Func<Metadata>, Action)
public AsyncClientStreamingCall(IClientStreamWriter<TRequest> requestStream, Task<TResponse> responseAsync, Task<Metadata> responseHeadersAsync, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction)
Creates a new AsyncClientStreamingCall object with the specified properties.
Parameters | |
---|---|
Name | Description |
requestStream |
IClientStreamWriter Stream of request values. |
responseAsync |
Task The response of the asynchronous call. |
responseHeadersAsync |
TaskMetadata Response headers of the asynchronous call. |
getStatusFunc |
FuncStatus Delegate returning the status of the call. |
getTrailersFunc |
FuncMetadata Delegate returning the trailing metadata of the call. |
disposeAction |
Action Delegate to invoke when Dispose is called on the call object. |
Properties
RequestStream
public IClientStreamWriter<TRequest> RequestStream { get; }
Async stream to send streaming requests.
Property Value | |
---|---|
Type | Description |
IClientStreamWriter |
ResponseAsync
public Task<TResponse> ResponseAsync { get; }
Asynchronous call result.
Property Value | |
---|---|
Type | Description |
Task |
ResponseHeadersAsync
public Task<Metadata> ResponseHeadersAsync { get; }
Asynchronous access to response headers.
Property Value | |
---|---|
Type | Description |
TaskMetadata |
Methods
ConfigureAwait(bool)
public ConfiguredTaskAwaitable<TResponse> ConfigureAwait(bool continueOnCapturedContext)
Configures an awaiter used to await this AsyncClientStreamingCall<TRequest, TResponse>.
Parameter | |
---|---|
Name | Description |
continueOnCapturedContext |
bool true to attempt to marshal the continuation back to the original context captured; otherwise, false. |
Returns | |
---|---|
Type | Description |
ConfiguredTaskAwaitable |
An object used to await this task. |
Dispose()
public void Dispose()
Provides means to cleanup after the call. If the call has already finished normally (request stream has been completed and call result has been received), doesn't do anything. Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. As a result, all resources being used by the call should be released eventually.
Normally, there is no need for you to dispose the call unless you want to utilize the
"Cancel" semantics of invoking Dispose
.
GetAwaiter()
public TaskAwaiter<TResponse> GetAwaiter()
Gets an awaiter used to await this AsyncClientStreamingCall<TRequest, TResponse>.
Returns | |
---|---|
Type | Description |
TaskAwaiter |
An awaiter instance. |
This method is intended for compiler use rather than use directly in code.
GetStatus()
public Status GetStatus()
Gets the call status if the call has already finished. Throws InvalidOperationException otherwise.
Returns | |
---|---|
Type | Description |
Status |
GetTrailers()
public Metadata GetTrailers()
Gets the call trailing metadata if the call has already finished. Throws InvalidOperationException otherwise.
Returns | |
---|---|
Type | Description |
Metadata |