Table of Contents

Class GrpcReflectionService

Namespace
Virtufin.Api.Services
Assembly
Virtufin.Api.dll

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

channelPool GrpcChannelPool
logger ILogger<GrpcReflectionService>
configuration IConfiguration

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

serviceName string

The name of the service as registered with the gateway.

fileName string

The proto file name (e.g. "workmanager.proto").

cancellationToken CancellationToken

A cancellation token.

Returns

Task<bool>

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

serviceName string

The name of the service as registered with the gateway.

symbol string

The fully-qualified symbol to look up.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<bool>

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

serviceName string
methodName string
requestData byte[]
metadata Dictionary<string, string>
cancellationToken CancellationToken
callerDeadline DateTime?

Returns

Task<GrpcCallResult>

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

serviceName string
methodName string
requestJson string
metadata Dictionary<string, string>
cancellationToken CancellationToken
callerDeadline DateTime?

Returns

Task<GrpcCallResult>

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

serviceName string

The name of the service.

methodName string

The name of the method.

type string

Optional type name for schema resolution.

cancellationToken CancellationToken

A 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

serviceName string

The name of the service to query.

cancellationToken CancellationToken

A 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

serviceName string

The name of the service.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<List<ByteString>>

List of ByteString containing the descriptor protos, dependencies first.

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

serviceName string

The name of the service as registered with the gateway.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<List<string>>