Table of Contents

Class InvokerExtensions

Namespace
IceRpc.Protobuf
Assembly
IceRpc.Protobuf.dll

Provides extension methods for IInvoker.

public static class InvokerExtensions
Inheritance
InvokerExtensions
Inherited Members

Methods

InvokeBidiStreamingAsync<TInput, TOutput>(IInvoker, ServiceAddress, string, IAsyncEnumerable<TInput>, MessageParser<TOutput>, ProtobufEncodeOptions?, IFeatureCollection?, bool, CancellationToken)

Sends a request to a service and decodes the response. This method is for Protobuf bidi-streaming RPCs.

public static Task<IAsyncEnumerable<TOutput>> InvokeBidiStreamingAsync<TInput, TOutput>(this IInvoker invoker, ServiceAddress serviceAddress, string operation, IAsyncEnumerable<TInput> stream, MessageParser<TOutput> messageParser, ProtobufEncodeOptions? encodeOptions = null, IFeatureCollection? features = null, bool idempotent = false, CancellationToken cancellationToken = default) where TInput : IMessage<TInput> where TOutput : IMessage<TOutput>

Parameters

invoker IInvoker

The invoker used to send the request.

serviceAddress ServiceAddress

The address of the target service.

operation string

The name of the operation, as specified in Protobuf.

stream IAsyncEnumerable<TInput>

The stream of input message to encode in the request payload continuation.

messageParser MessageParser<TOutput>

The Google.Protobuf.MessageParser<T> used to decode the response payload.

encodeOptions ProtobufEncodeOptions

The options to customize the encoding of the request payload continuation.

features IFeatureCollection

The invocation features.

idempotent bool

When true, the request is idempotent.

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

Task<IAsyncEnumerable<TOutput>>

The operation's return value.

Type Parameters

TInput

The type of the input message.

TOutput

The type of the output message.

InvokeClientStreamingAsync<TInput, TOutput>(IInvoker, ServiceAddress, string, IAsyncEnumerable<TInput>, MessageParser<TOutput>, ProtobufEncodeOptions?, IFeatureCollection?, bool, CancellationToken)

Sends a request to a service and decodes the response. This method is for Protobuf client-streaming RPCs.

public static Task<TOutput> InvokeClientStreamingAsync<TInput, TOutput>(this IInvoker invoker, ServiceAddress serviceAddress, string operation, IAsyncEnumerable<TInput> stream, MessageParser<TOutput> messageParser, ProtobufEncodeOptions? encodeOptions = null, IFeatureCollection? features = null, bool idempotent = false, CancellationToken cancellationToken = default) where TInput : IMessage<TInput> where TOutput : IMessage<TOutput>

Parameters

invoker IInvoker

The invoker used to send the request.

serviceAddress ServiceAddress

The address of the target service.

operation string

The name of the operation, as specified in Protobuf.

stream IAsyncEnumerable<TInput>

The stream of input message to encode in the request payload continuation.

messageParser MessageParser<TOutput>

The Google.Protobuf.MessageParser<T> used to decode the response payload.

encodeOptions ProtobufEncodeOptions

The options to customize the encoding of the request payload continuation.

features IFeatureCollection

The invocation features.

idempotent bool

When true, the request is idempotent.

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

Task<TOutput>

The operation's return value.

Type Parameters

TInput

The type of the input message.

TOutput

The type of the output message.

InvokeServerStreamingAsync<TOutput>(IInvoker, ServiceAddress, string, IMessage, MessageParser<TOutput>, ProtobufEncodeOptions?, IFeatureCollection?, bool, CancellationToken)

Sends a request to a service and decodes the response. This method is for Protobuf server-streaming RPCs.

public static Task<IAsyncEnumerable<TOutput>> InvokeServerStreamingAsync<TOutput>(this IInvoker invoker, ServiceAddress serviceAddress, string operation, IMessage inputMessage, MessageParser<TOutput> messageParser, ProtobufEncodeOptions? encodeOptions = null, IFeatureCollection? features = null, bool idempotent = false, CancellationToken cancellationToken = default) where TOutput : IMessage<TOutput>

Parameters

invoker IInvoker

The invoker used to send the request.

serviceAddress ServiceAddress

The address of the target service.

operation string

The name of the operation, as specified in Protobuf.

inputMessage IMessage

The input message to encode in the request payload.

messageParser MessageParser<TOutput>

The Google.Protobuf.MessageParser<T> used to decode the response payload.

encodeOptions ProtobufEncodeOptions

The options to customize the encoding of the request payload.

features IFeatureCollection

The invocation features.

idempotent bool

When true, the request is idempotent.

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

Task<IAsyncEnumerable<TOutput>>

The operation's return value.

Type Parameters

TOutput

The type of the output message.

InvokeUnaryAsync<TOutput>(IInvoker, ServiceAddress, string, IMessage, MessageParser<TOutput>, ProtobufEncodeOptions?, IFeatureCollection?, bool, CancellationToken)

Sends a request to a service and decodes the response. This method is for Protobuf unary RPCs.

public static Task<TOutput> InvokeUnaryAsync<TOutput>(this IInvoker invoker, ServiceAddress serviceAddress, string operation, IMessage inputMessage, MessageParser<TOutput> messageParser, ProtobufEncodeOptions? encodeOptions = null, IFeatureCollection? features = null, bool idempotent = false, CancellationToken cancellationToken = default) where TOutput : IMessage<TOutput>

Parameters

invoker IInvoker

The invoker used to send the request.

serviceAddress ServiceAddress

The address of the target service.

operation string

The name of the operation, as specified in Protobuf.

inputMessage IMessage

The input message to encode in the request payload.

messageParser MessageParser<TOutput>

The Google.Protobuf.MessageParser<T> used to decode the response payload.

encodeOptions ProtobufEncodeOptions

The options to customize the encoding of the request payload.

features IFeatureCollection

The invocation features.

idempotent bool

When true, the request is idempotent.

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

Task<TOutput>

The operation's return value.

Type Parameters

TOutput

The type of the output message.