Interface IGatewayApi
The gateway itself: service discovery and typed dispatch to a backend service.
public interface IGatewayApi
Methods
InvokeAsync<TRequest, TResponse>(string, string, TRequest, MessageParser<TResponse>, TimeSpan?, CancellationToken)
Calls method on the backend service through
Gateway.Invoke, protobuf bytes in and out. A backend failure the gateway
reports in-band (its status/message) is thrown as
GatewayInvokeException. No JSON and no reflection: safe under
NativeAOT, unlike the dynamic client.service.Method(dictionary) form.
parser is the response message's Parser (e.g.
CreateWorkerResponse.Parser); a null timeout
leaves the deadline to the gateway's default (30 s).
Task<TResponse> InvokeAsync<TRequest, TResponse>(string service, string method, TRequest request, MessageParser<TResponse> parser, TimeSpan? timeout = null, CancellationToken cancellationToken = default) where TRequest : IMessage where TResponse : IMessage<TResponse>
Parameters
servicestringmethodstringrequestTRequestparserMessageParser<TResponse>timeoutTimeSpan?cancellationTokenCancellationToken
Returns
- Task<TResponse>
Type Parameters
TRequestTResponse
ListServicesAsync(CancellationToken)
Task<List<string>> ListServicesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken