Class InvokerExtensions
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
IInvokerThe invoker used to send the request.
serviceAddress
ServiceAddressThe address of the target service.
operation
stringThe 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
ProtobufEncodeOptionsThe options to customize the encoding of the request payload continuation.
features
IFeatureCollectionThe invocation features.
idempotent
boolWhen true, the request is idempotent.
cancellationToken
CancellationTokenA 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
IInvokerThe invoker used to send the request.
serviceAddress
ServiceAddressThe address of the target service.
operation
stringThe 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
ProtobufEncodeOptionsThe options to customize the encoding of the request payload continuation.
features
IFeatureCollectionThe invocation features.
idempotent
boolWhen true, the request is idempotent.
cancellationToken
CancellationTokenA 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
IInvokerThe invoker used to send the request.
serviceAddress
ServiceAddressThe address of the target service.
operation
stringThe name of the operation, as specified in Protobuf.
inputMessage
IMessageThe input message to encode in the request payload.
messageParser
MessageParser<TOutput>The Google.Protobuf.MessageParser<T> used to decode the response payload.
encodeOptions
ProtobufEncodeOptionsThe options to customize the encoding of the request payload.
features
IFeatureCollectionThe invocation features.
idempotent
boolWhen true, the request is idempotent.
cancellationToken
CancellationTokenA 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
IInvokerThe invoker used to send the request.
serviceAddress
ServiceAddressThe address of the target service.
operation
stringThe name of the operation, as specified in Protobuf.
inputMessage
IMessageThe input message to encode in the request payload.
messageParser
MessageParser<TOutput>The Google.Protobuf.MessageParser<T> used to decode the response payload.
encodeOptions
ProtobufEncodeOptionsThe options to customize the encoding of the request payload.
features
IFeatureCollectionThe invocation features.
idempotent
boolWhen true, the request is idempotent.
cancellationToken
CancellationTokenA cancellation token that receives the cancellation requests.
Returns
- Task<TOutput>
The operation's return value.
Type Parameters
TOutput
The type of the output message.