Class InvokerExtensions
- Namespace
- IceRpc.Protobuf.RpcMethods
- 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<IAsyncStream<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 : class, IMessage<TInput> where TOutput : class, IMessage<TOutput>
Parameters
invokerIInvokerThe invoker used to send the request.
serviceAddressServiceAddressThe address of the target service.
operationstringThe name of the operation, as specified in Protobuf.
streamIAsyncEnumerable<TInput>The stream of input message to encode in the request payload continuation.
messageParserMessageParser<TOutput>The Google.Protobuf.MessageParser<T> used to decode the response payload.
encodeOptionsProtobufEncodeOptionsThe options to customize the encoding of the request payload continuation.
featuresIFeatureCollectionThe invocation features.
idempotentboolWhen true, the request is idempotent.
cancellationTokenCancellationTokenA cancellation token that receives the cancellation requests.
Returns
- Task<IAsyncStream<TOutput>>
The operation's return value.
Type Parameters
TInputThe type of the input message.
TOutputThe 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 : class, IMessage<TInput> where TOutput : class, IMessage<TOutput>
Parameters
invokerIInvokerThe invoker used to send the request.
serviceAddressServiceAddressThe address of the target service.
operationstringThe name of the operation, as specified in Protobuf.
streamIAsyncEnumerable<TInput>The stream of input message to encode in the request payload continuation.
messageParserMessageParser<TOutput>The Google.Protobuf.MessageParser<T> used to decode the response payload.
encodeOptionsProtobufEncodeOptionsThe options to customize the encoding of the request payload continuation.
featuresIFeatureCollectionThe invocation features.
idempotentboolWhen true, the request is idempotent.
cancellationTokenCancellationTokenA cancellation token that receives the cancellation requests.
Returns
- Task<TOutput>
The operation's return value.
Type Parameters
TInputThe type of the input message.
TOutputThe 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<IAsyncStream<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 : class, IMessage<TOutput>
Parameters
invokerIInvokerThe invoker used to send the request.
serviceAddressServiceAddressThe address of the target service.
operationstringThe name of the operation, as specified in Protobuf.
inputMessageIMessageThe input message to encode in the request payload.
messageParserMessageParser<TOutput>The Google.Protobuf.MessageParser<T> used to decode the response payload.
encodeOptionsProtobufEncodeOptionsThe options to customize the encoding of the request payload.
featuresIFeatureCollectionThe invocation features.
idempotentboolWhen true, the request is idempotent.
cancellationTokenCancellationTokenA cancellation token that receives the cancellation requests.
Returns
- Task<IAsyncStream<TOutput>>
The operation's return value.
Type Parameters
TOutputThe 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 : class, IMessage<TOutput>
Parameters
invokerIInvokerThe invoker used to send the request.
serviceAddressServiceAddressThe address of the target service.
operationstringThe name of the operation, as specified in Protobuf.
inputMessageIMessageThe input message to encode in the request payload.
messageParserMessageParser<TOutput>The Google.Protobuf.MessageParser<T> used to decode the response payload.
encodeOptionsProtobufEncodeOptionsThe options to customize the encoding of the request payload.
featuresIFeatureCollectionThe invocation features.
idempotentboolWhen true, the request is idempotent.
cancellationTokenCancellationTokenA cancellation token that receives the cancellation requests.
Returns
- Task<TOutput>
The operation's return value.
Type Parameters
TOutputThe type of the output message.