Class GrpcReflectionService
Provides gRPC reflection functionality including service discovery, method schema retrieval, and dynamic gRPC invocation based on reflection data.
public class GrpcReflectionService
- Inheritance
-
GrpcReflectionService
- Inherited Members
Constructors
GrpcReflectionService(GrpcChannelPool, ILogger<GrpcReflectionService>, IConfiguration)
public GrpcReflectionService(GrpcChannelPool channelPool, ILogger<GrpcReflectionService> logger, IConfiguration configuration)
Parameters
channelPoolGrpcChannelPoolloggerILogger<GrpcReflectionService>configurationIConfiguration
Methods
ContainsFileAsync(string, string, CancellationToken)
Returns true when the backend's descriptor set includes the given proto file name.
public Task<bool> ContainsFileAsync(string serviceName, string fileName, CancellationToken cancellationToken = default)
Parameters
serviceNamestringThe name of the service as registered with the gateway.
fileNamestringThe proto file name (e.g. "workmanager.proto").
cancellationTokenCancellationTokenA cancellation token.
Returns
ContainsSymbolAsync(string, string, CancellationToken)
Returns true when the backend's descriptor set defines the given fully-qualified symbol (any kind DescriptorSymbols lists: service, method, message, field, oneof, extension, enum or enum value).
public Task<bool> ContainsSymbolAsync(string serviceName, string symbol, CancellationToken cancellationToken = default)
Parameters
serviceNamestringThe name of the service as registered with the gateway.
symbolstringThe fully-qualified symbol to look up.
cancellationTokenCancellationTokenA cancellation token.
Returns
ExecuteCallAsync(string, string, byte[], Dictionary<string, string>?, CancellationToken, DateTime?)
Executes a unary gRPC call by name with raw protobuf bytes, passed through unchanged; the response bytes are in ResponseDataBytes.
public Task<GrpcCallResult> ExecuteCallAsync(string serviceName, string methodName, byte[] requestData, Dictionary<string, string>? metadata = null, CancellationToken cancellationToken = default, DateTime? callerDeadline = null)
Parameters
serviceNamestringmethodNamestringrequestDatabyte[]metadataDictionary<string, string>cancellationTokenCancellationTokencallerDeadlineDateTime?
Returns
ExecuteCallAsync(string, string, string, Dictionary<string, string>?, CancellationToken, DateTime?)
Executes a unary gRPC call by name with a JSON request; the response is returned as JSON in Data.
public Task<GrpcCallResult> ExecuteCallAsync(string serviceName, string methodName, string requestJson, Dictionary<string, string>? metadata = null, CancellationToken cancellationToken = default, DateTime? callerDeadline = null)
Parameters
serviceNamestringmethodNamestringrequestJsonstringmetadataDictionary<string, string>cancellationTokenCancellationTokencallerDeadlineDateTime?
Returns
GetMethodSchemaAsync(string, string, string?, CancellationToken)
Gets the schema for a specific method including input/output types and field definitions.
public Task<MethodSchema?> GetMethodSchemaAsync(string serviceName, string methodName, string? type = null, CancellationToken cancellationToken = default)
Parameters
serviceNamestringThe name of the service.
methodNamestringThe name of the method.
typestringOptional type name for schema resolution.
cancellationTokenCancellationTokenA cancellation token.
Returns
- Task<MethodSchema>
The method schema or null if not found.
GetMethodsAsync(string, CancellationToken)
Retrieves all methods for a given service using gRPC reflection.
public Task<IReadOnlyList<ServiceMethodInfo>> GetMethodsAsync(string serviceName, CancellationToken cancellationToken = default)
Parameters
serviceNamestringThe name of the service to query.
cancellationTokenCancellationTokenA cancellation token.
Returns
- Task<IReadOnlyList<ServiceMethodInfo>>
A snapshot of the service's methods.
GetOrderedFileDescriptorProtosAsync(string, CancellationToken)
Retrieves the file descriptor protos for a service in dependency order, including google/protobuf/descriptor.proto, which backend reflection servers omit. Suitable for feeding into a descriptor pool in returned order.
public Task<List<ByteString>> GetOrderedFileDescriptorProtosAsync(string serviceName, CancellationToken cancellationToken = default)
Parameters
serviceNamestringThe name of the service.
cancellationTokenCancellationTokenA cancellation token.
Returns
GetServiceFullNamesAsync(string, CancellationToken)
Returns the fully-qualified names of the gRPC services exposed by a backend (e.g. "virtufin.WorkManager"), loading the reflection cache on demand.
public Task<List<string>> GetServiceFullNamesAsync(string serviceName, CancellationToken cancellationToken = default)
Parameters
serviceNamestringThe name of the service as registered with the gateway.
cancellationTokenCancellationTokenA cancellation token.