Class AsyncClientStreamingCall<TRequest, TResponse>
Return type for client streaming calls.
Inheritance
Implements
Inherited Members
Namespace: Grpc.Core
Assembly: Grpc.Core.Api.dll
Syntax
public sealed class AsyncClientStreamingCall<TRequest, TResponse> : IDisposable
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)
Creates a new AsyncClientStreamingCall object with the specified properties.
Declaration
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)
Parameters
Type | Name | Description |
---|---|---|
IClientStreamWriter<TRequest> | requestStream | Stream of request values. |
System.Threading.Tasks.Task<TResponse> | responseAsync | The response of the asynchronous call. |
System.Func<System.Object, System.Threading.Tasks.Task<Metadata>> | responseHeadersAsync | Response headers of the asynchronous call. |
System.Func<System.Object, Status> | getStatusFunc | Delegate returning the status of the call. |
System.Func<System.Object, Metadata> | getTrailersFunc | Delegate returning the trailing metadata of the call. |
System.Action<System.Object> | disposeAction | Delegate to invoke when Dispose is called on the call object. |
System.Object | state | State object for use with the callback parameters. |
AsyncClientStreamingCall(IClientStreamWriter<TRequest>, Task<TResponse>, Task<Metadata>, Func<Status>, Func<Metadata>, Action)
Creates a new AsyncClientStreamingCall object with the specified properties.
Declaration
public AsyncClientStreamingCall(IClientStreamWriter<TRequest> requestStream, Task<TResponse> responseAsync, Task<Metadata> responseHeadersAsync, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction)
Parameters
Type | Name | Description |
---|---|---|
IClientStreamWriter<TRequest> | requestStream | Stream of request values. |
System.Threading.Tasks.Task<TResponse> | responseAsync | The response of the asynchronous call. |
System.Threading.Tasks.Task<Metadata> | responseHeadersAsync | Response headers of the asynchronous call. |
System.Func<Status> | getStatusFunc | Delegate returning the status of the call. |
System.Func<Metadata> | getTrailersFunc | Delegate returning the trailing metadata of the call. |
System.Action | disposeAction | Delegate to invoke when Dispose is called on the call object. |
Properties
RequestStream
Async stream to send streaming requests.
Declaration
public IClientStreamWriter<TRequest> RequestStream { get; }
Property Value
Type | Description |
---|---|
IClientStreamWriter<TRequest> |
ResponseAsync
Asynchronous call result.
Declaration
public Task<TResponse> ResponseAsync { get; }
Property Value
Type | Description |
---|---|
System.Threading.Tasks.Task<TResponse> |
ResponseHeadersAsync
Asynchronous access to response headers.
Declaration
public Task<Metadata> ResponseHeadersAsync { get; }
Property Value
Type | Description |
---|---|
System.Threading.Tasks.Task<Metadata> |
Methods
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.
Declaration
public void Dispose()
Implements
Remarks
Normally, there is no need for you to dispose the call unless you want to utilize the
"Cancel" semantics of invoking Dispose
.
GetAwaiter()
Allows awaiting this object directly.
Declaration
public TaskAwaiter<TResponse> GetAwaiter()
Returns
Type | Description |
---|---|
System.Runtime.CompilerServices.TaskAwaiter<TResponse> |
GetStatus()
Gets the call status if the call has already finished. Throws InvalidOperationException otherwise.
Declaration
public Status GetStatus()
Returns
Type | Description |
---|---|
Status |
GetTrailers()
Gets the call trailing metadata if the call has already finished. Throws InvalidOperationException otherwise.
Declaration
public Metadata GetTrailers()
Returns
Type | Description |
---|---|
Metadata |