Class AsyncDuplexStreamingCall<TRequest, TResponse> (2.48.0)

public sealed class AsyncDuplexStreamingCall<TRequest, TResponse> : IDisposable

Return type for bidirectional streaming calls.

Inheritance

Object > AsyncDuplexStreamingCall<TRequest, TResponse>

Namespace

Grpc.Core

Assembly

Grpc.Core.Api.dll

Type Parameters

NameDescription
TRequest

Request message type for this call.

TResponse

Response message type for this call.

Constructors

AsyncDuplexStreamingCall(IClientStreamWriter<TRequest>, IAsyncStreamReader<TResponse>, Func<Object, Task<Metadata>>, Func<Object, Status>, Func<Object, Metadata>, Action<Object>, Object)

public AsyncDuplexStreamingCall(IClientStreamWriter<TRequest> requestStream, IAsyncStreamReader<TResponse> responseStream, Func<object, Task<Metadata>> responseHeadersAsync, Func<object, Status> getStatusFunc, Func<object, Metadata> getTrailersFunc, Action<object> disposeAction, object state)

Creates a new AsyncDuplexStreamingCall object with the specified properties.

Parameters
NameDescription
requestStreamIClientStreamWriter<TRequest>

Stream of request values.

responseStreamIAsyncStreamReader<TResponse>

Stream of response values.

responseHeadersAsyncFunc<Object, Task<Metadata>>

Response headers of the asynchronous call.

getStatusFuncFunc<Object, Status>

Delegate returning the status of the call.

getTrailersFuncFunc<Object, Metadata>

Delegate returning the trailing metadata of the call.

disposeActionAction<Object>

Delegate to invoke when Dispose is called on the call object.

stateObject

State object for use with the callback parameters.

AsyncDuplexStreamingCall(IClientStreamWriter<TRequest>, IAsyncStreamReader<TResponse>, Task<Metadata>, Func<Status>, Func<Metadata>, Action)

public AsyncDuplexStreamingCall(IClientStreamWriter<TRequest> requestStream, IAsyncStreamReader<TResponse> responseStream, Task<Metadata> responseHeadersAsync, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction)

Creates a new AsyncDuplexStreamingCall object with the specified properties.

Parameters
NameDescription
requestStreamIClientStreamWriter<TRequest>

Stream of request values.

responseStreamIAsyncStreamReader<TResponse>

Stream of response values.

responseHeadersAsyncTask<Metadata>

Response headers of the asynchronous call.

getStatusFuncFunc<Status>

Delegate returning the status of the call.

getTrailersFuncFunc<Metadata>

Delegate returning the trailing metadata of the call.

disposeActionAction

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
TypeDescription
IClientStreamWriter<TRequest>

ResponseHeadersAsync

public Task<Metadata> ResponseHeadersAsync { get; }

Asynchronous access to response headers.

Property Value
TypeDescription
Task<Metadata>

ResponseStream

public IAsyncStreamReader<TResponse> ResponseStream { get; }

Async stream to read streaming responses.

Property Value
TypeDescription
IAsyncStreamReader<TResponse>

Methods

Dispose()

public void Dispose()

Provides means to cleanup after the call. If the call has already finished normally (request stream has been completed and response stream has been fully read), 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.

Remarks

Normally, there is no need for you to dispose the call unless you want to utilize the "Cancel" semantics of invoking Dispose.

GetStatus()

public Status GetStatus()

Gets the call status if the call has already finished. Throws InvalidOperationException otherwise.

Returns
TypeDescription
Status

GetTrailers()

public Metadata GetTrailers()

Gets the call trailing metadata if the call has already finished. Throws InvalidOperationException otherwise.

Returns
TypeDescription
Metadata