Class BidirectionalStreamingBase<TRequest, TResponse>
Base class for bidirectional streaming RPC methods.
Inheritance
Inherited Members
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 |
|
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 |
|
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 |
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. |