Show / Hide Table of Contents

Class BidirectionalStreamingBase<TRequest, TResponse>

Base class for bidirectional streaming RPC methods.

Inheritance
System.Object
BidirectionalStreamingBase<TRequest, TResponse>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Api.Gax.Grpc
Assembly: Google.Api.Gax.Grpc.dll
Syntax
public abstract class BidirectionalStreamingBase<TRequest, TResponse>
Type Parameters
Name Description
TRequest

RPC request type

TResponse

RPC response type

Properties

GrpcCall

The underlying gRPC duplex streaming call. Warning: DO NOT USE GrpcCall.RequestStream at all if using TryWriteAsync(TRequest), WriteAsync(TRequest), TryWriteAsync(TRequest, WriteOptions) , or WriteAsync(TRequest, WriteOptions). Doing so will cause conflict with the write-buffer used within the [Try]WriteAsync methods.

Declaration
public virtual AsyncDuplexStreamingCall<TRequest, TResponse> GrpcCall { get; }
Property Value
Type Description
AsyncDuplexStreamingCall<TRequest, TResponse>

ResponseStream

Async stream to read streaming responses.

Declaration
public virtual IAsyncEnumerator<TResponse> ResponseStream { get; }
Property Value
Type Description
System.Collections.Generic.IAsyncEnumerator<TResponse>

Methods

TryWriteAsync(TRequest)

Writes a message to the stream, if there is enough space in the buffer and WriteCompleteAsync() hasn't already been called. The same write options will be used as for the previous message.

Declaration
public virtual Task TryWriteAsync(TRequest message)
Parameters
Type Name Description
TRequest message

The message to write.

Returns
Type Description
System.Threading.Tasks.Task

null if the message queue is full or the stream has already been completed; otherwise, a System.Threading.Tasks.Task which will complete when the message has been written to the stream.

TryWriteAsync(TRequest, WriteOptions)

Writes a message to the stream, if there is enough space in the buffer and WriteCompleteAsync() hasn't already been called.

Declaration
public virtual Task TryWriteAsync(TRequest message, WriteOptions options)
Parameters
Type Name Description
TRequest message

The message to write.

WriteOptions options

The write options to use for this message.

Returns
Type Description
System.Threading.Tasks.Task

null if the message queue is full or the stream has already been completed.

TryWriteCompleteAsync()

Completes the stream when all buffered messages have been sent. Only the first call to this method on any instance will have any effect; subsequent calls will return null.

Declaration
public virtual Task TryWriteCompleteAsync()
Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task which will complete when the stream has finished being completed; or null if this method has already been called.

WriteAsync(TRequest)

Writes a message to the stream, if there is enough space in the buffer and WriteCompleteAsync() hasn't already been called. The same write options will be used as for the previous message.

Declaration
public virtual Task WriteAsync(TRequest message)
Parameters
Type Name Description
TRequest message

The message to write.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task which will complete when the message has been written to the stream.

Exceptions
Type Condition
System.InvalidOperationException

There isn't enough space left in the buffer, or WriteCompleteAsync() has already been called.

WriteAsync(TRequest, WriteOptions)

Writes a message to the stream, if there is enough space in the buffer and WriteCompleteAsync() hasn't already been called.

Declaration
public virtual Task WriteAsync(TRequest message, WriteOptions options)
Parameters
Type Name Description
TRequest message

The message to write.

WriteOptions options

The write options to use for this message.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task which will complete when the message has been written to the stream.

Exceptions
Type Condition
System.InvalidOperationException

There isn't enough space left in the buffer, or WriteCompleteAsync() has already been called.

WriteCompleteAsync()

Completes the stream when all buffered messages have been sent. This method can only be called once, and further messages cannot be written after it has been called.

Declaration
public virtual Task WriteCompleteAsync()
Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task which will complete when the stream has finished being completed.

Exceptions
Type Condition
System.InvalidOperationException

This method has already been called.

Back to top